-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Really like the package, only problem I'm having right now is that FutureBuilders spawns false positives when assigning a function to be used as a future.
An example would be
Future<String> getValue() async {
await Future.delayed(Duration(seconds: 3));
return 'Woolha';
}
FutureBuilder<String>(
future: getValue(),
builder: (
BuildContext context,
AsyncSnapshot<String> snapshot,
) {
print(snapshot.connectionState);
if (snapshot.connectionState == ConnectionState.waiting) {
return CircularProgressIndicator();
} else if (snapshot.connectionState == ConnectionState.done) {
if (snapshot.hasError) {
return const Text('Error');
} else if (snapshot.hasData) {
return Text(snapshot.data);
} else {
return const Text('Empty data');
}
} else {
return Text('State: ${snapshot.connectionState}');
}
},
)
And getValue() is now rightfully marked as non-awaited future, however because this is a future builder this function is not used as such. Is this a user error on my part or is this just a false positive part of the framework?
MelbourneDeveloper
Metadata
Metadata
Assignees
Labels
No labels