Chapter 6 Bug ( grocery_list_screen)

mport ‘package:flutter/material.dart’;
import ‘…/components/grocery_tile.dart’;
import ‘…/models/models.dart’;
import ‘grocery_item_screen.dart’;
import ‘…/models/grocery_item.dart’;

class GroceryListScreen extends StatelessWidget {
final GroceryManager manager;

const GroceryListScreen({Key? key, required this.manager}) : super(key: key);

@override
Widget build(BuildContext context) {
final groceryItems = manager.groceryItems;
return Padding(
padding: const EdgeInsets.all(16.0),
child: ListView.separated(
itemCount: groceryItems.length,
itemBuilder: (context, index) {
final item = groceryItems[index];
//TODO 28: Wrap in a Dismissable
//TODO 27: Wrap in an InkWell
return GroceryTile(
key: Key(item.id), //Problem : The getter id isnt defined for the type GroceryManager
item: item, // Problem : The argument type ‘GroceryManager’ cant be assign to the parameter type ‘GroceryItem’
onComplete: (change){
if (change != null) {
manager.completeItem(index, change!);
}
},
);
},
separatorBuilder: (context, index){
return const SizedBox(height: 16.0);
},
),
);
}
}

I have highlighted the 2 bugs and given the error message that it displays. Any help appreciated thanks!

@lediomalasi
In which section of chapter 6 is this happening?
Can you use the final project to pinpoint if you mistyped something?

1 Like

Omg you are right i had mistyped something! Thank you for pointing it out.

1 Like