title: How to get data from the FutureProvider in flutter
body: <p>I'm trying to implement local database support in my flutter app which is being managed using Provider, now I want to make the retrieving of data obey the state management pattern, but I've been failing to.</p>
  
  <p>I've tried to make a traditional Provider to achieve this but the app got stuck in a loop of requests to the database, so after some search I found the FutureProvider, but I cant find how can I get a snapshot from the data being loaded</p>
  
  <pre><code>class _ReceiptsRouteState extends State&lt;ReceiptsRoute&gt; {
    List&lt;Receipt&gt; receipts = [];
  
    @override
    Widget build(BuildContext context) {
      return FutureProvider(
        initialData: List(),
        builder: (_){
          return DBProvider().receipts().then((result) {
            receipts = result;
          });
        },
        child: Scaffold(
          appBar: AppBar(
            title: Text(AppLocalizations.of(context).history),
          ),
          body: Container(
            child: ListView.builder(
              itemBuilder: (context, position) {
                final item = receipts[position];
                return ListTile(
                  title: Text(item.date),
                );
              },
            ),
          ),
        ),
      );
    }
  }
  </code></pre>
  
  <p>now my app is running as I want but not as how it should run, I used FutureBuilder to get the data from the database directly but I know it should come through the provider so I want to make it right</p>