flutter как передавать информацию из data file в builder
у меня есть GridView.bulder, который строит GestureDetector's, при нажатии на каждый я перехожу Details с помощью [index]. В каждом из этих GestureDetector's есть также список с GestureDetector's, но здесь я не понимаю, как я могу открывать конкретный Data file, привязанный к изначальному [index], я пытался создать список в списке так
class Brand {
final String image, title;
final int id;
final List <Subject> subjects;
Brand({
this.id,
this.image,
this.title,
this.subjects,
});
}
class Subject {
final int acura_id;
final String acura_image, acura_title;
Subject({
this.acura_id,
this.acura_image,
this.acura_title,
});
}
List<Brand> brands = [
Brand(
id: 1,
title: "ACURA",
image: "images/acura-logo.png",
subjects: [
Subject(
acura_id: 1,
acura_image: "images/acura/ilx.png",
acura_title: "ILX"
),
Subject(
acura_id: 2,
acura_image: "images/acura/rdx.png",
acura_title: "RDX"
),
],
),
];
но при вызове "${brand.subjects.acura_id}" выдает ошибку error: The getter 'acura_id' isn't defined for the type 'List'. (undefined_getter at [save_me] lib/cars_name.dart:43)
Возможно, я использую не тот способ, если вы мне поможете понять почему я не могу вызвать список или подскажете на какой способ сменить код, буду благодарен