Wassef Hassine
Wassef Hassine

Reputation: 209

flutter send list to another class

Is there a way to send list from class to another class without any button click ? I tried

MesFavorisOn(arr: Items)

But it gives me error enter image description here

thanks.

I have a list on class named Prochaines

List<Item> Items = [
Item(
  nb: 0,
  Vip: true,
  Image: "assets/images/watch-gt2-listimage-Matte-Black.png",
  TimeLeft: "04h 27m 03s",
  ParticpantsPercent: "65%",
  Title: "HUAWEI SMART WATCH GT2",
  MagasinPrice: "899DT",
  DepartPrice: "1 DT",
  Remise: "279DT",
  ButtonText: "Participez à 6 Dt",
),
Item(
  nb: 1,
  Vip: false,
  Image: "assets/images/xiaomi-redmi-7a.png",
  TimeLeft: "04h 27m 03s",
  ParticpantsPercent: "20%",
  Title: "REDMI 7A BLACK",
  MagasinPrice: "4 999 DT",
  DepartPrice: "1 DT",
  Remise: "40DT",
  ButtonText: "Participez gratuiment",
),
Item(
  nb: 2,
  Vip: false,
  Image: "assets/images/xiaomi-redmi-7a.png",
  TimeLeft: "04h 27m 03s",
  ParticpantsPercent: "65%",
  Title: "REDMI 7A BLACK",
  MagasinPrice: "4 999 DT",
  DepartPrice: "1 DT",
  Remise: "40DT",
  ButtonText: "Participez gratuiment",
),

];

i wanna send it to a class named MesFavorisOn which has a constructor

 List<Item> arr = [];

MesFavorisOn({required this.arr});

Upvotes: 1

Views: 176

Answers (1)

Ali Rasouli
Ali Rasouli

Reputation: 111

You did it right but you have problem in your ui objects . I guess you didn't give fixed height to your ListView

Upvotes: 2

Related Questions