title: Unhandled Exception: type 'List<dynamic>' is not a subtype of type 'Map<String, dynamic>'
body: <p>UPDATE: Thanks to @Rjulcaa answer My map is now a List, however the List wasn't displayed on the UI. I turns that I needed to handle the future with a FutureBuilder, so in case anyone faces this problem remember to add a FutureBuilder to the body of your UI and on the builder return the widget you want to be displayed. </p>
  
  <p>I'm making a todo list tutorial, I'm trying to add the feature of  encoding  on a JSON my todoList the save it on a sharedPreferences, and when I start the app retrieve it on the screen </p>
  
  <p>This is my TODO class</p>
  
  <pre><code>class Todo  {
  Todo ({this.title,this.isDone = false});
  String title;
  bool isDone;
  
  
  //Decode method to convert a Json String into a Dynamic object
  Todo.fromJson(Map &lt;String, dynamic&gt; json)
  : title = json ["title"],
    isDone  = json ["isDone"];
  Map &lt;String,dynamic&gt; toJson() =&gt;
  {
         "title" : title,
         "isDone" : isDone
  };
  }
  </code></pre>
  
  <p>This is my screen </p>
  
  <pre><code>class _TodoListScreenState extends State&lt;TodoListScreen&gt; {
  List&lt;Todo&gt; todos = [];
  @override
  void initState() {
  super.initState();
   _getTodoFromSharedPreferences();
  
  }
  
  
  
  //updates the state of the checkbox and reflects it on the UI
  _toggleTodo(Todo todo, bool isChecked) {
  setState(() {
    todo.isDone = isChecked;
  });
  }
  
  _addTodo() async {
  final todo = await showDialog&lt;Todo&gt;(
    context: context,
  builder:(BuildContext context) { // &lt;- Here you draw the Dialog
    return NewTodoDialog();
  },
  );
  if (todo != null) {
    setState(() {
      todos.add(todo);
      _saveTodo(todos);
      print(todos.length);
  
      });
     }
     }
  
     _saveTodo(List&lt;Todo&gt; todo) async{
     final String newTodo = jsonEncode(todo);
     setSharedPreferences(newTodo);
     }
  
  
  
      _getTodoFromSharedPreferences () async {
      final prefs = await SharedPreferences.getInstance();
      final savedTodo = prefs.getString("savedTodo");
      if (savedTodo == null) {return null;} else {
      Map MapofTodos = jsonDecode(savedTodo);
    for (var i = 0; i &lt; MapofTodos.length; ++i) {
      var o = MapofTodos[i];
      setState(() {
        Todo todo = Todo.fromJson(o);
        todos.add(todo);
      });
  
  
    }
  
  
  }
  }
   setSharedPreferences (String newTodo ) async{
   final prefs = await SharedPreferences.getInstance();
   await prefs.setString("savedTodo", newTodo );
   print(newTodo);
   }
  
   @override
    Widget build(BuildContext context) {
     return Scaffold(
              appBar: AppBar(backgroundColor:Colors.deepPurple[900] ,
                 title: Text('Todo List')),
         body: TodoList(
           todos: todos,
           onTodoToggle: _toggleTodo,
         ),
         floatingActionButton: FloatingActionButton(
           backgroundColor: Colors.purpleAccent[700],
           child: Icon(Icons.add),
           onPressed: _addTodo,
         ),
     );
    }
  
  
    }
  </code></pre>
  
  <p>when I run the app i get this error</p>
  
  <pre><code>E/flutter ( 7476): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] 
  Unhandled Exception: type 'List&lt;dynamic&gt;' is not a subtype of type 
  'Map&lt;dynamic, dynamic&gt;'
  E/flutter ( 7476): #0      
  _TodoListScreenState._getTodoFromSharedPreferences 
  (package:flutter_todo/UI/todo_list_screen.dart:70:11)
  E/flutter ( 7476): &lt;asynchronous suspension&gt;
  E/flutter ( 7476): #1      _TodoListScreenState.initState 
  (package:flutter_todo/UI/todo_list_screen.dart:29:6)
  E/flutter ( 7476): #2      StatefulElement._firstBuild 
  (package:flutter/src/widgets/framework.dart:3851:58)
  E/flutter ( 7476): #3      ComponentElement.mount 
  (package:flutter/src/widgets/framework.dart:3716:5)
  E/flutter ( 7476): #4      Element.inflateWidget 
  (package:flutter/src/widgets/framework.dart:2960:14)
  E/flutter ( 7476): #5      Element.updateChild 
  (package:flutter/src/widgets/framework.dart:2763:12)
  E/flutter ( 7476): #6      SingleChildRenderObjectElement.mount 
  (package:flutter/src/widgets/framework.dart:4881:14)
  E/flutter ( 7476): #7      Element.inflateWidget 
  (package:flutter/src/widgets/framework.dart:2960:14)
  E/flutter ( 7476): #8      Element.updateChild 
  (package:flutter/src/widgets/framework.dart:2763:12)
  E/flutter ( 7476): #9      ComponentElement.performRebuild 
  (package:flutter/src/widgets/framework.dart:3752:16)
  E/flutter ( 7476): #10     Element.rebuild 
  (package:flutter/src/widgets/framework.dart:3564:5)
  E/flutter ( 7476): #11     ComponentElement._firstBuild 
  (package:flutter/src/widgets/framework.dart:3721:5)
  E/flutter ( 7476): #12     ComponentElement.mount 
  (package:flutter/src/widgets/framework.dart:3716:5)
  E/flutter ( 7476): #13     Element.inflateWidget 
  (package:flutter/src/widgets/framework.dart:2960:14)
  E/flutter ( 7476): #14     Element.updateChild 
  (package:flutter/src/widgets/framework.dart:2763:12)
  E/flutter ( 7476): #15     SingleChildRenderObjectElement.mount 
  (package:flutter/src/widgets/framework.dart:4881:14)
  E/flutter ( 7476): #16     Element.inflateWidget 
  (package:flutter/src/widgets/framework.dart:2960:14)
  E/flutter ( 7476): #17     Element.updateChild 
  (package:flutter/src/widgets/framework.dart:2763:12)
  E/flutter ( 7476): #18     SingleChildRenderObjectElement.mount 
  (package:flutter/src/widgets/framework.dart:4881:14)
  E/flutter ( 7476): #19     Element.inflateWidget 
  (package:flutter/src/widgets/framework.dart:2960:14)
  E/flutter ( 7476): #20     Element.updateChild 
  (package:flutter/src/widgets/framework.dart:2763:12)
  E/flutter ( 7476): #21     SingleChildRenderObjectElement.mount 
  (package:flutter/src/widgets/framework.dart:4881:14)
  E/flutter ( 7476): #22     Element.inflateWidget 
  (package:flutter/src/widgets/framework.dart:2960:14)
  E/flutter ( 7476): #23     Element.updateChild 
  (package:flutter/src/widgets/framework.dart:2763:12)
  E/flutter ( 7476): #24     SingleChildRenderObjectElement.mount 
  (package:flutter/src/widgets/framework.dart:4881:14)
  E/flutter ( 7476): #25     Element.inflateWidget 
  (package:flutter/src/widgets/framework.dart:2960:14)
  E/flutter ( 7476): #26     Element.updateChild 
  (package:flutter/src/widgets/framework.dart:2763:12)
  E/flutter ( 7476): #27     ComponentElement.performRebuild 
  (package:flutter/src/widgets/framework.dart:3752:16)
  E/flutter ( 7476): #28     Element.rebuild 
  (package:flutter/src/widgets/framework.dart:3564:5)
  E/flutter ( 7476): #29     ComponentElement._firstBuild 
  (package:flutter/src/widgets/framework.dart:3721:5)
  E/flutter ( 7476): #30     StatefulElement._firstBuild 
  (package:flutter/src/widgets/framework.dart:3869:11)
  E/flutter ( 7476): #31     ComponentElement.mount 
  (package:flutter/src/widgets/framework.dart:3716:5)
  E/flutter ( 7476): #32     Element.inflateWidget 
  (package:flutter/src/widgets/framework.dart:2960:14)
  E/flutter ( 7476): #33     Element.updateChild 
  (package:flutter/src/widgets/framework.dart:2763:12)
  E/flutter ( 7476): #34     ComponentElement.performRebuild 
  (package:flutter/src/widgets/framework.dart:3752:16)
  E/flutter ( 7476): #35     Element.rebuild 
  (package:flutter/src/widgets/framework.dart:3564:5)
  E/flutter ( 7476): #36     ComponentElement._firstBuild 
  (package:flutter/src/widgets/framework.dart:3721:5)
  E/flutter ( 7476): #37     ComponentElement.mount 
  (package:flutter/src/widgets/framework.dart:3716:5)
  E/flutter ( 7476): #38     Element.inflateWidget 
  (package:flutter/src/widgets/framework.dart:2960:14)
  E/flutter ( 7476): #39     Element.updateChild 
  (package:flutter/src/widgets/framework.dart:2763:12)
  E/flutter ( 7476): #40     ComponentElement.performRebuild 
  (package:flutter/src/widgets/framework.dart:3752:16)
  E/flutter ( 7476): #41     Element.rebuild 
  (package:flutter/src/widgets/framework.dart:3564:5)
  E/flutter ( 7476): #42     ComponentElement._firstBuild 
  (package:flutter/src/widgets/framework.dart:3721:5)
  E/flutter ( 7476): #43     StatefulElement._firstBuild 
  (package:flutter/src/widgets/framework.dart:3869:11)
  E/flutter ( 7476): #44     ComponentElement.mount 
  (package:flutter/src/widgets/framework.dart:3716:5)
  E/flutter ( 7476): #45     Ele
  </code></pre>
  
  <p>I tried to change the List to a Map but didn't succeed</p>
  
  <p>I have succeeded on everything except returning the widget to the screen.
  Help me, please :c</p>