title: Get user data with Rest API in Flutter
body: <p>I created a function using rest API to get one user data:</p>
  <p>code:</p>
  <pre><code>  Future&lt;User&gt; getUser(int id) async{
      final response = await client.get('$baseUrl/user/$id');
      if(response.statusCode == 200){
        return userFromJson(response.body);
      }else return null;
    }
  </code></pre>
  <p>I must get data from user which is current logged in to this sytem, so I get his <code>id</code> from response with using <code>sharedPreferences</code>:</p>
  <pre><code>sharedPreferences.setInt(&quot;id&quot;, jsonResponse['id']);
  
  </code></pre>
  <p>but i don't know how to create an <code>FutureBuilder</code> which
  would insert the appropriate id into my rest api function,</p>
  <p>I try this:</p>
  <pre><code>class _HomeScreenState extends State&lt;HomeScreen&gt; {
    BuildContext context;
    ApiService apiService;
    SharedPreferences sharedPreferences;
  
    @override
    void initState() {
      super.initState();
      apiService = ApiService();
    }
  
    checkStorageStatus() async {
      sharedPreferences = await SharedPreferences.getInstance();
    }
  
    @override
    Widget build(BuildContext context) {
      this.context = context;
      return SafeArea(
        child: FutureBuilder(
          future: apiService.getProfiles(), //I DON'T KNOW HOW TO PUT ID INTO THI FUNCTION
          builder: (BuildContext context, AsyncSnapshot&lt;List&lt;Profile&gt;&gt; snapshot) {
            if (snapshot.hasError) {
              return Center(
                child: Text(
                    &quot;Something wrong with message: ${snapshot.error.toString()}&quot;),
              );
            } else if (snapshot.connectionState == ConnectionState.done) {
              User user = snapshot.data;
              return _buildListView(user);
            } else {
              return Center(
                child: CircularProgressIndicator(),
              );
            }
          },
        ),
      );
    }
  </code></pre>
  <p>but i can't put my ID into <code>apiService.getProfiles()</code> function,
  can anybody help me?</p>
  <p>thanks for any help :)</p>