Update for the deprecation of BitmapDescriptor.fromBytes
#11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As of
google_maps_flutter_platform_interface: 2.8.0
The method
BitmapDescriptor.fromBytes
has been deprecated in favor ofBitmapDescriptor.bytes
andBytesMapBitmap
.The changes in this pull request include
BitmapDescriptor.bytes
toBitmapDescriptor.fromBytes
.BitmapDescriptor.bytes
solves a platform specific bug with the marker size , this fix in turn make the markers too bigConsideration for migration added on the README with the following text
Migrating to 1.0
The update to the
google_maps_flutter_platform_interface: ^2.8.0
changes that, DeprecateBitmapDescriptor.fromBytes
in favor ofBitmapDescriptor.bytes
andBytesMapBitmap
.This fixed a long standing bug where the markers size would change depending of the platform.
The workaround before used to be to multiply the
devicePixelRatio
to thewidth
andheight
of theBitmapDescriptor.fromBytes
to make the markers the same size across platforms and use the value of 1 fordevicePixelRatio
of web platform.This would make code like this:
Before
Now this code will have to be changed to:
After
It is more straightforward and easier to maintain. This being the only consideration if you have been mainting a multiplatform app with this package, or
google_maps_flutter
in general.