iampawan / 30DaysOfFlutter

Learn Flutter in 30 Days
413 stars 323 forks source link

Encountered some issues #34

Open noumi92 opened 2 years ago

noumi92 commented 2 years ago

Encountered following bugs and applied undermentioned fixes

items were not initialized -> initialized as empty list static List<Item> items = List.empty(); required field missing in Item() constructor -> added required keyword Item({required this.id, ....}); Null safety found missing in copyWith() Item copyWith({ String? id ... In factory fromMap() the line which checks map nullability throwing error -> commented //if (map == null) return null; In home.dart list was not mapping to model -> distributed into two assignments List<Item> list = List.from(productsData) .map<Item>((item) => Item.fromMap(item)) .toList(); CatalogModel.items = list;

noumi92 commented 2 years ago

I am just a beginner. It is not to criticize rather to get help and learn more.