I get the following error:
A value of type \'Future\' can\'t be assigned to a variable of type \'int\'
Future
returning the potential value which will be done by async
work
Eg:
Future getValue() async {
return Future.value(5);
}
Above code is returning Future.value(5)
which is of int
type, but while receiving the value from method we can't use type Future
i.e
Future value = await getValue(); // Not Allowed
// Error
A value of type 'Future' can't be assigned to a variable of type 'int'
To solve above getValue() should be received under int
type
int value = await getValue(); // right way as it returning the potential value.