Ошибка в вашем ListViewBuilder:
ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: _ListFamilyPageState.data.body.family.length,
itemBuilder: (context, index) {
return Container(
height: 74.0,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topRight: const Radius.circular(20.0),
bottomRight: const Radius.circular(20.0)),
),
width: MediaQuery.of(context).size.width - 50.0,
child: Center(
child: Text(
data.body.friends[index].id.toString(),
style:
TextStyle(fontSize: 24.0),
)));
},
)
Вы указали, что есть family.length
элементов (в ваших данных: 15), но вы извлекаете фактические данные из friends[index]
(8 элементов в ваши данные).
Это дает вам RangeError при отображении элемента с индексом 8.
Кроме того: вы используете данные stati c в своем состоянии:
class _ListFamilyPageState extends State<ListFamily> {
static Relations data;
// ...
}
Не делай этого.