DEV Community

Discussion on: Shopping cart app using BLoC pattern in Flutter

Collapse
 
matthewawbrown profile image
Matthew Brown

Hello, I found this as a lovely tutorial for a similar project that I had to do for a course I was taking.
I encountered a slight issue because I wanted to play with this code to try and understand BLoC a little better and in the checkout.dart file, my line 12
"return snapshot.data['cart items'].length > 0" has a build error stating "The method '[]' can't be unconditionally invoked because the receiver can be 'null'."

Is this an issue with a newer version of flutter/dart? I can't for the life of me figure out how to satisfy the compiler.