title: How to use riverpod for future without run app
body: <p>I am developing an app with flutter and I am using flutter_riverpod package. I am very new in flutter_riverpod.</p>
  <p>I have a page which getting datas from database. The datas are article datas.
  I have 3 .dart file for this process. I have a lot of files but but for that process ı have only 3)</p>
  <ol>
  <li>AAmain.dart file.</li>
  <li>AAx2.dart file.</li>
  <li>AAapi.dart file</li>
  </ol>
  <p>The AAmain.dart file is my first page of app. This page shows all article as a list in listview. with http call but no problem for getting datas or writing for listview.</p>
  <p>The AAx2.dart file is my second page of app. This page shows only 1 article details. for instance article image, article title, article concent etc.</p>
  <p>The AAapi.dart file is not a page of app. It is only a function which has a fetch 1 article details from server(with http).</p>
  <p>My purpose is click item AAmain.dart page and go AAx2.dart page with bring 1 data and fetch datas for 1 article.
  But I don't know send datas between pages. I can send AAmain.dart to x2.dart file. But I can't send to AAapi.dart. Because AAapi.dart has no providerscope or ref or widgetref. I don't understand here.</p>
  <p>I used to use getx package for send datas between pages with arguments but now I am using flutter_riverpod but I can't understand.
  This issue is so important for me thanks for all helps.</p>
  <p>I simplified my codes to has an easy understand.(But only ui codes).</p>
  <p>AAmain.dart file</p>
  <pre><code>    import 'package:flutter/material.dart';
  import 'package:flutter_riverpod/flutter_riverpod.dart';
  import 'wp-api.dart';
  import 'AAx2.dart';
  import 'package:flutter_eem_1/custom.dart';
  
  void main() {
    runApp(ProviderScope(child: benimApp0()));
  }
  
  class benimApp0 extends ConsumerWidget {
    @override
    Widget build(BuildContext context, WidgetRef ref) {
      return MaterialApp(
        theme: ThemeData(),
        home: Scaffold(
          body: SafeArea(
            child: xMyHomePage(),
          ),
        ),
      );
    }
  }
  
  class xMyHomePage extends ConsumerWidget {
    @override
    Widget build(BuildContext context, WidgetRef ref) {
      return Scaffold(
        body: Column(
          children: [
            Container(
              child: FutureBuilder&lt;List&lt;dynamic&gt;&gt;(
                  future: fetchWpPosts(),
                  builder: (context, snapshot) {
                    if (snapshot.hasData) {
                      return ListView.builder(
                        itemCount: 5,
                        itemBuilder: (BuildContext context, int index) {
                          return InkWell(
                            onTap: () {
                              Navigator.of(context).push(createRoute1());
                              final aVider = StateProvider(
                                  (_) =&gt; snapshot.data![index][&quot;slug&quot;]);
  
                              //  Get.toNamed(&quot;/home&quot;,
                              //      arguments: snapshot.data![index][&quot;slug&quot;]);
                            },
                            child: Column(
                              children: [
                                Container(
                                  child: Image.network(
                                    snapshot.data![index][&quot;featured_image&quot;]
                                            [&quot;large&quot;]
                                        .toString(),
                                  ),
                                ),              
                              ],
                            ),
                          );
                        },
                      );
                    }
                    return Container();
                  }),
            ),
          ],
        ),
      );
    }
  }
  </code></pre>
  <p>AAx2.dart file</p>
  <pre><code>import 'package:flutter/material.dart';
  import 'package:flutter_eem_1/singlewp-api.dart';
  import 'package:flutter_riverpod/flutter_riverpod.dart';
  import 'package:flutter_eem_1/AAapi.dart';
  
  
  void main() {
    runApp(ProviderScope(child: benimApp1()));
  }
  
  class benimApp1 extends ConsumerWidget {
    @override
    Widget build(BuildContext context, WidgetRef ref) {
      return MaterialApp(
        theme: ThemeData(),
        home: Scaffold(
          body: SafeArea(
            child: x2(),
          ),
        ),
      );
    }
  }
  
  class x2 extends ConsumerWidget {
    @override
    Widget build(BuildContext context, WidgetRef ref) {
      return Scaffold(
        body: Column(
          children: [
            SingleChildScrollView(
              child: Container(
                child: FutureBuilder&lt;List&lt;dynamic&gt;&gt;(
                    future: fetch1WpPosts(),
                    builder: (context, snapshot) {
                      if (snapshot.hasData) {
                        return Column(
                          children: [
                            Text(
                              snapshot.data![0][&quot;title&quot;],
                              style: const TextStyle(
                                  fontSize: 25, fontWeight: FontWeight.bold),
                            ),
                            Container(
                              child: Image.network(
                                  snapshot.data![0][&quot;featured_image_large&quot;]),
                            ),
                          ],
                        );
                      }
                      return Container();
                    }),
              ),
            ),
          ],
        ),
      );
    }
  }
  </code></pre>
  <p>AAapi.dart file</p>
  <pre><code>              import 'package:flutter_eem_1/riverpodTry1.dart';
                import 'package:flutter_riverpod/flutter_riverpod.dart';
                import 'package:http/http.dart' as http;
                import 'dart:convert';
                import 'AAx2.dart';
                import 'AAmain.dart';
  
  Future&lt;List&lt;dynamic&gt;&gt; fetch_1WpPosts() async {
      final String data1 = ref.watch(aVider);
    
    var x = 'https://meshcurrent.online/wp/wp-json/api/v1/posts/';
    var y = data1;
    var z = '$x$y';
  
    final response = await http.get(Uri.parse(z));
    List&lt;dynamic&gt; convertDataJson = jsonDecode(response.body);
  
    return convertDataJson;
  }
  </code></pre>
  <p>the problem is ref in future AAapi.dart file.</p>