We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thanks for the work done on this package.
I'm trying to limit calls to https://pub.dev/packages/geocode to 1 per second, because of the API limit.
I created the following class:
class DebouncedGeoCode { final GeoCode geoCode = GeoCode(); final debouncer = Debouncing<Address?>(duration: const Duration(milliseconds: 1000)); Future<Address?> reverseGeocoding( {required double latitude, required double longitude}) async { return debouncer.debounce(() => geoCode.reverseGeocoding(latitude: latitude, longitude: longitude)); } }
dart complains:
The return type 'Future<Address>' isn't a 'Address?', as required by the closure's context.
reversGeocoding returns Future<Address>
reversGeocoding
Future<Address>
The text was updated successfully, but these errors were encountered:
I fixed it by using
class DebouncedGeoCode { final GeoCode geoCode = GeoCode(); final debouncer = Debouncing<Future<Address>>(duration: const Duration(milliseconds: 1000)); Future<Address?> reverseGeocoding( {required double latitude, required double longitude}) async { var response = await debouncer.debounce(() => geoCode.reverseGeocoding(latitude: latitude, longitude: longitude)); return await response; } }
which makes sense, the debouncer don't need to know if the value is a Future
Sorry, something went wrong.
No branches or pull requests
Thanks for the work done on this package.
I'm trying to limit calls to https://pub.dev/packages/geocode to 1 per second, because of the API limit.
I created the following class:
dart complains:
reversGeocoding
returnsFuture<Address>
The text was updated successfully, but these errors were encountered: