With the code below I get the following error message:
The argument type 'String?' can't be assigned to the parameter type 'String'.dart(argument_type_not_assignable)
The part of the code producing the error (at least I think it does) is the following:
class _HomePageState extends State<HomePage> {
Map<String, dynamic> todo = {};
TextEditingController _controller = new TextEditingController();
@override
void initState() {
_loadData();
}
_loadData() async {
SharedPreferences storage = await SharedPreferences.getInstance();
if (storage.getString('todo') != null) {
todo = jsonDecode(storage.getString('todo'));
}
}