Search code examples
flutterandroid-studioflutter-dependencies

Why am I getting this error in futurebuilder


enter image description here

I have no idea why I'm getting an error


Solution

  • It will return null if the condition is not fulfilled. You need to return something outside of your conditional statement or in a else condition

    FutureBuilder<List<Mesajlar>>(   
      future: mesajlarifetir),
      builder: (context ‚snapshot) {
        if (snapshot.hasData) {
        var mesailistesi = snapshot. data;
        return ListView.builder (
      );} 
      return CircularProgressIndicator(); //Add this line
    })