Skip to main content
edited title
Link

Snaphhot Snapshot data null but FutureBuilder return data?

deleted 3 characters in body
Source Link

I have http response data but IT IS NULL????? ...
Future getcategoryimage() async{ var url = "http://172.17.40.225/shoplacviet/getcategoryimage.php"; var reponse = await http.get(Uri.parse(url)); var list = reponse.body; Uint8List _bytesImage; _bytesImage = Base64Decoder().convert(list); return _bytesImage; }

...
FutureBuilder(
          future: getcategoryimage(),
          builder: (context,snapshot){
            List lista = snapshot.data as List;//------------> I have http response data but IT IS NULL?????
  if(snapshot.hasError) print(snapshot.error);
        return snapshot.hasData ? ListView.builder(
            scrollDirection: Axis.vertical,
            shrinkWrap: true,
            itemCount: lista.length,
            itemBuilder: (context,index){
              var blob = lista[index]['categoryimage'];
              Uint8List _bytesImage;
              _bytesImage = Base64Decoder().convert(blob);
              return Container(
                child: Image.memory(_bytesImage),
              );
            }):Center(child: CircularProgressIndicator(),) ;
      },
    ),

I have http response data but IT IS NULL????? ...
Future getcategoryimage() async{ var url = "http://172.17.40.225/shoplacviet/getcategoryimage.php"; var reponse = await http.get(Uri.parse(url)); var list = reponse.body; Uint8List _bytesImage; _bytesImage = Base64Decoder().convert(list); return _bytesImage; }

...
FutureBuilder(
          future: getcategoryimage(),
          builder: (context,snapshot){
            List lista = snapshot.data as List;//------------> I have http response data but IT IS NULL?????
  if(snapshot.hasError) print(snapshot.error);
        return snapshot.hasData ? ListView.builder(
            scrollDirection: Axis.vertical,
            shrinkWrap: true,
            itemCount: lista.length,
            itemBuilder: (context,index){
              var blob = lista[index]['categoryimage'];
              Uint8List _bytesImage;
              _bytesImage = Base64Decoder().convert(blob);
              return Container(
                child: Image.memory(_bytesImage),
              );
            }):Center(child: CircularProgressIndicator(),) ;
      },
    ),

I have http response data but IT IS NULL????? ...
Future getcategoryimage() async{ var url = "http://172.17.40.225/shoplacviet/getcategoryimage.php"; var reponse = await http.get(Uri.parse(url)); var list = reponse.body; Uint8List _bytesImage; _bytesImage = Base64Decoder().convert(list); return _bytesImage; }

...
FutureBuilder(
          future: getcategoryimage(),
          builder: (context,snapshot){
            List lista = snapshot.data as List;//------------> I have http response data but IT IS NULL?????
  if(snapshot.hasError) print(snapshot.error);
        return snapshot.hasData ? ListView.builder(
            scrollDirection: Axis.vertical,
            shrinkWrap: true,
            itemCount: lista.length,
            itemBuilder: (context,index){
              var blob = lista[index]['categoryimage'];
              Uint8List _bytesImage;
              _bytesImage = Base64Decoder().convert(blob);
              return Container(
                child: Image.memory(_bytesImage),
              );
            }):Center(child: CircularProgressIndicator(),) ;
      },
    ),
Source Link

Snaphhot data null but FutureBuilder return data?

I have http response data but IT IS NULL????? ...
Future getcategoryimage() async{ var url = "http://172.17.40.225/shoplacviet/getcategoryimage.php"; var reponse = await http.get(Uri.parse(url)); var list = reponse.body; Uint8List _bytesImage; _bytesImage = Base64Decoder().convert(list); return _bytesImage; }

...
FutureBuilder(
          future: getcategoryimage(),
          builder: (context,snapshot){
            List lista = snapshot.data as List;//------------> I have http response data but IT IS NULL?????
  if(snapshot.hasError) print(snapshot.error);
        return snapshot.hasData ? ListView.builder(
            scrollDirection: Axis.vertical,
            shrinkWrap: true,
            itemCount: lista.length,
            itemBuilder: (context,index){
              var blob = lista[index]['categoryimage'];
              Uint8List _bytesImage;
              _bytesImage = Base64Decoder().convert(blob);
              return Container(
                child: Image.memory(_bytesImage),
              );
            }):Center(child: CircularProgressIndicator(),) ;
      },
    ),