StyleImage class sealed

An image that can be added to a map style (icons, patterns, image sources).

Prefer StyleImage.bytes for the common case — PNG/JPEG/WebP from rootBundle, the network, or a file. Use StyleImage.rgba only when generating pixels yourself.

final image = StyleImage.bytes(
  (await rootBundle.load('assets/icon.png')).buffer.asUint8List(),
);

Constructors

StyleImage.bytes(Uint8List bytes)
Encoded image bytes (PNG, JPEG, WebP, …).
const
factory
StyleImage.rgba({required int width, required int height, required Uint8List pixels})
Premultiplied RGBA pixel buffer.
factory

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

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

fromImage(Image image) Future<StyleImage>
Converts a dart:ui ui.Image to a StyleImage.