I'm building a flutter gallery app from this reference Flutter Image Gallery
All works fine but I'm getting error inside Future Builder
This is the error warning I'm getting
The name 'Uint8List' isn't a type so it can't be used as a type argument.
Try correcting the name to an existing type, or defining a type named 'Uint8List'.
And this is the runtime error I'm getting
Error: 'Uint8List' isn't a type.
return FutureBuilder<Uint8List>(
^^^^^^^^^
This Uint8List
is totally new concept for me, don't know what to do.
This is the widget that returns a Future Builder
@override
Widget build(BuildContext context) {
// We're using a FutureBuilder since thumbData is a future
return FutureBuilder<Uint8List>(
future: asset.thumbData,
builder: (_, snapshot) {
final bytes = snapshot.data;
// If we have no data, display a spinner
if (bytes == null) return CircularProgressIndicator();
// If there's data, display it as an image
return InkWell(
onTap: () {
// TODO: navigate to Image/Video screen
},
child: Stack(
children: [
// Wrap the image in a Positioned.fill to fill the space
Positioned.fill(
child: Image.memory(bytes, fit: BoxFit.cover),
),
// Display a Play icon if the asset is a video
if (asset.type == AssetType.video)
Center(
child: Container(
color: Colors.blue,
child: Icon(
Icons.play_arrow,
color: Colors.white,
),
),
),
],
),
);
},
);
}
I've search it on google but doesn't get any satisfied answer. Thanks in advance.
FutureBuilder<Uint8List>
to
FutureBuilder<dynamic>
or
FutureBuilder<List<int>>