memory static method
- Uint8List bytes, {
- required MarkerProperties markerLayerProperties,
- MapController? mapController,
- Key? key,
- Widget builder(
- BuildContext context,
- MarkerProperties markerProperties,
- Map<
String, dynamic> ? map
- PowerMarkerClusterOptions? powerClusterOptions,
Creates a widget that displays a marker on a map using image data provided as
a Uint8List.
The bytes parameter specifies the image data as a Uint8List that will be used
as the marker icon.
The markerLayerProperties parameter is required and contains properties for the marker,
such as position and rotation.
The mapController parameter allows you to specify a custom MapController to control
the map view. If not provided, the default MapController will be used.
The builder parameter is an optional callback function that allows you to customize
the marker widget's appearance. It takes a BuildContext, MarkerProperties, and a
map of extra data as arguments and should return a widget. If not provided, a default
marker widget will be used.
The key parameter is an optional key that can be used to uniquely identify this widget.
Example usage:
memory(
myImageBytes,
markerLayerProperties: MarkerProperties(
position: LatLng(37.7749, -122.4194),
rotation: 45.0,
),
mapController: myMapController,
builder: (context, markerProperties, extraData) {
return Icon(Icons.location_on, color: Colors.green);
},
)
In this example, the memory widget will display a marker on the map using the
image data provided in myImageBytes, with custom properties, a custom builder
function, and a specified map controller.
Returns a FutureBuilder widget that will build the marker widget once the image data is loaded.
Implementation
static Widget memory(
Uint8List bytes, {
required MarkerProperties markerLayerProperties,
MapController? mapController,
Key? key,
Widget Function(
BuildContext context,
MarkerProperties markerProperties,
Map<String, dynamic>? map,
)?
builder,
PowerMarkerClusterOptions? powerClusterOptions,
}) {
return EnhancedFutureBuilder<Widget>(
future: _memoryMarkers(
bytes,
powerClusterOptions: powerClusterOptions,
markerLayerProperties: markerLayerProperties,
mapController: mapController,
builder: builder,
key: key,
),
rememberFutureResult: true,
whenDone: (Widget snapshotData) => snapshotData,
whenNotDone: const Center(child: CupertinoActivityIndicator()),
);
}