title: Flutter, future builder and snapshot.data, the data never gets loaded
body: <p>I'm trying to build a very simple app notes and save the notes to a local database using SQFlite package. In my code I'm using a future build to display a CircularProgressIndicator while the data gets loaded from the database, and the db is empty at the moment, so the app should display an empty body. My problem is that the data never gets loaded and the circular progress indicator is infinite. Also the button 'Add Note' opens an alert dialog with two text fields that should take the text, insert it into the table from the db and the text should be displayed in a Card in the body, yet that does not happen.
  My code:</p>
  
  <p>main.dart</p>
  
  <pre><code>import 'package:flutter/material.dart';
  
  import 'home_screen.dart';
  import 'note_inherited_widget.dart';
  
  void main() {
    runApp(MyApp());
  }
  
  class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return NoteInheritedWidget(
            MaterialApp(
          home: HomeScreen(),
          theme: ThemeData(
              primaryColor: Colors.deepOrange, accentColor: Colors.deepPurple),
        ),
      );
    }
  }
  </code></pre>
  
  <p>home_screen.dart</p>
  
  <pre><code>import 'package:flutter/material.dart';
  
  import 'package:simple_notes/note_inherited_widget.dart';
  import 'package:simple_notes/providers/note_providers.dart';
  import './note_inherited_widget.dart';
  
  class HomeScreen extends StatefulWidget {
    @override
    _HomeScreenState createState() =&gt; _HomeScreenState();
  }
  
  class _HomeScreenState extends State&lt;HomeScreen&gt; {
    final TextEditingController titleController = TextEditingController();
    final TextEditingController textController = TextEditingController();
  
    @override
    void dispose() {
      // Clean up the controller when the widget is disposed.
      titleController.dispose();
      textController.dispose();
      super.dispose();
    }
  
    DummyDataProvider notes;
  
    @override
    void didChangeDependencies() {
      super.didChangeDependencies();
      notes = NoteInheritedWidget.of(context);
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
          appBar: AppBar(
            title: Text('Simple Notes'),
            centerTitle: true,
          ),
          body: FutureBuilder(
              future: NoteProvider.getNoteList(),
              builder: (context, snapshot) {
                if (snapshot.connectionState == ConnectionState.done) {
                  final notes = snapshot.data;
                  ListView.builder(
                    itemBuilder: (context, index) {
                      return Card(
                        child: Column(
                          children: &lt;Widget&gt;[
                            NoteTitle(notes[index]['title']),
                            NoteText(notes[index]['text'])
                          ],
                        ),
                      );
                    },
                    itemCount: notes.length,
                  );
                }
                return Center(child: CircularProgressIndicator());
              }
              ),
          bottomNavigationBar: (FlatButton(
              onPressed: () {
                showMyDialog(context);
              },
              child: Text('Add note'))));
    }
  
    Future&lt;void&gt; showMyDialog(
      BuildContext context,
    ) {
      return showDialog&lt;void&gt;(
          context: context,
          builder: (BuildContext context) {
            return AlertDialog(
              content: Column(
                children: &lt;Widget&gt;[
                  TextField(
                    controller: titleController,
                  ),
                  TextField(
                    controller: textController,
                  )
                ],
              ),
              actions: &lt;Widget&gt;[
                MaterialButton(onPressed: () {
                  final title = titleController.text;
                  final text = textController.text;
                  NoteProvider.insertNote({
                    'title': title,
                    'text': text
                  });
                  Navigator.pop(context);
                }, 
                child: Text('save')
                )
              ],
            );
          });
    }
  }
  
  class NoteTitle extends StatelessWidget {
    final String title;
  
    NoteTitle(this.title);
  
    @override
    Widget build(BuildContext context) {
      return Text(
        title,
        style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
      );
    }
  }
  
  class NoteText extends StatelessWidget {
    final String text;
  
    NoteText(this.text);
  
    @override
    Widget build(BuildContext context) {
      return Text(
        text,
        style: TextStyle(
          color: Colors.grey.shade600,
        ),
        maxLines: 2,
        overflow: TextOverflow.ellipsis,
      );
    }
  }
  
  class SaveButton extends StatelessWidget {
    final Function onPressed;
  
    SaveButton(this.onPressed);
  
    @override
    Widget build(BuildContext context) {
      return MaterialButton(
        onPressed: () {
  
          Navigator.pop(context);
        },
        child: Text('Save'),
      );
    }
  }
  </code></pre>
  
  <p>note_providers.dart</p>
  
  <pre><code>import 'package:sqflite/sqflite.dart';
  import 'package:path/path.dart';
  
  class NoteProvider {
    static Database db;
  
    static Future open() async {
      db = await openDatabase(join(await getDatabasesPath(), 'notes.db'),
      version: 1,
      onCreate: (Database db, int version) async {
        db.execute('''
        CREATE TABLE notes(
          id INTEGER PRIMARY KEY AUTOINCREMENT,
          title TEXT NOT NULL,
          text TEXT NOT NULL
        );
        ''');
       }
      );
    }
  
    static Future&lt;List&lt;Map&lt;String, dynamic&gt;&gt;&gt; getNoteList() async {
        if (db == null) {
          await open();
        }
        return await db.query('Notes');
      }
  
      static Future insertNote (Map&lt;String, dynamic&gt; note) async {
        await db.insert('Notes', note);
      }
  }
  </code></pre>
  
  <p>If you could shed some light as why this is happening, that would be terrific. I haven't been able to pinpoint the problem as I'm still learning flutter.</p>
  
  <p>Thanks in advance.</p>