cached_network_marker 0.1.1
cached_network_marker: ^0.1.1 copied to clipboard

Bitmap generator for Google Map custom marker. Supports network image and caching.

CachedNetworkMarker #

Bitmap generator for Google Map custom marker. Supports network image and caching.

sample screen shot

Motivation #

Creating custom marker on Google Maps for flutter is little complicated.

  • You have to provide the bitmap of your target object
  • You have to resize and position in right way if you use the image
  • Generating the marker bitmap costs a lot of machine resource so you have to cache the bitmap

This package solves these problems and let you generate the beautiful marker with small code.

Supported marker shapes #

  • circle avatar

More shapes will be added in the future.

Usage #

This package does not contain Google maps for flutter plugin. Install it by yourself.

dependencies:
  google_maps_flutter:
  cached_network_marker:

You can get the bitmap by passing the url of image and call generator methods.

// create the instance of CachedNetworkMarker
final generator = CachedNetworkMarker(
  url: 'YOUR_IMAGE_URL',
  dpr: MediaQuery.of(context).devicePixelRatio,
);

// generate bitmap
final bitmap = await generator.circleAvatar(CircleAvatarParams(color: Colors.lightBlue));

// create marker with generated bitmap
final marker = Marker(
  markerId: MarkerId('0'),
  position: LatLng(37.42596133580664, -122.083749655962),
  icon: BitmapDescriptor.fromBytes(bitmap),
);

For more detailed usage, see example project

4
likes
120
pub points
42%
popularity

Publisher

shuneihayakawa.biz

Bitmap generator for Google Map custom marker. Supports network image and caching.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, flutter_cache_manager, freezed_annotation

More

Packages that depend on cached_network_marker