StyleEditor class

Tweaks the map style at runtime.

You get it from NativMapController.style.

What it's for

The Amazon Location style comes ready-made, and it's almost always what you want. This exists for the three things you almost always need on top:

  • Turning off what gets in the way. A map that's the background for your own data doesn't need points of interest or shop labels.
  • Matching the palette to the app's, without redoing the whole style.
  • Applying a theme that already exists, which is what the nativ_maps_google package does when it translates a Google JSON style.

What changes here doesn't survive a style change

Changing styleUrl reloads the style from the server and undoes all of this. You have to apply it again in NativMap.onStyleLoaded, which is called on every load, and not just the first, precisely for this reason.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

getColor(String layerId) → Future<Color?>
A layer's main color, if it can be read.
hideMatching(String keyword) → Future<int>
Turns off every layer whose identifier contains keyword.
layerIds() → Future<List<String>>
Just the identifiers, without looking up each one's type.
layers() → Future<List<StyleLayer>>
Every layer in the style, in the order they're drawn.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setColor(String layerId, Color color) → Future<bool>
Changes a layer's main color.
setLineWidth(String layerId, double width) → Future<bool>
Changes the width of a line layer.
setOpacity(String layerId, double opacity) → Future<bool>
Changes a layer's opacity.
setPaintProperties(String layerId, Map<String, Object?> properties) → Future<bool>
Applies paint properties to a layer.
setVisible(String layerId, {required bool visible}) → Future<void>
Turns a layer on or off.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited