flutter-geolocator
flutter-geolocator copied to clipboard
migrates geolocator_web to package:web
This PR migrates from dart:html to package:web and js_interop.
A few notes/questions:
- I've increased the dart/flutter sdk versions in geolocator_web in order to use js_interop. I'm unsure if we need to bump these versions in the other geolocator packages as well.
- Mockito can no longer be used with the new js_interop types (at least I ran into errors with it being unable to generate mocks).
- The package:web geolocation methods now require a timeout value, rather than allowing null. Infinity is the value for timeouts in the html geolocation api, but passing double.infinity.toInt as timeout throws an error that this is an invalid value when invoked in javascript. Instead of defaulted to a timeout of 1 day, but this needs more input.
- the test now require running with
flutter test --platform chrome, otherwise errors are thrown as js_interop can't be used in the dart vm.
Pre-launch Checklist
- [x] I made sure the project builds.
- [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
- [x] I updated
pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is does not need version changes. - [x] I updated
CHANGELOG.mdto add a description of the change. - [x] I updated/added relevant documentation (doc comments with
///). - [x] I rebased onto
main. - [x] I added new tests to check the change I am making, or this PR does not need tests.
- [x] I made sure all existing and new tests are passing.
- [x] I ran
dart format .and committed any changes. - [x] I ran
flutter analyzeand fixed any errors.