I've just stumbled upon a github repo containing an example of flutter application for google_sign_in package.
I'm confused about a particular usage of unawaited used inside the example :
Future<void> _handleAuthorizeScopes() async {
final bool isAuthorized = await _googleSignIn.requestScopes(scopes);
setState(() {
_isAuthorized = isAuthorized;
});
if (isAuthorized) {
unawaited(_handleGetContact(_currentUser!)); // --> this code
}
}
What confusing me is what's the difference between that and not using the unawaited function, i.e:
Future<void> _handleAuthorizeScopes() async {
final bool isAuthorized = await _googleSignIn.requestScopes(scopes);
setState(() {
_isAuthorized = isAuthorized;
});
if (isAuthorized) {
_handleGetContact(_currentUser!); // --> this code is changed
}
}
What I expect was that the result between the two approaches (using and not using unawaited) is the same, however if that's the case, then I'm even more confused of the need of the unawaited function.
Helps with linter messages, from the docs:
https://api.flutter.dev/flutter/dart-async/unawaited.html