getImage method
- Size? size,
- ImageFileFormat? format,
- SignpostImageRenderSettings renderSettings = const SignpostImageRenderSettings(),
- bool allowResize = false,
Rendered image bytes for this signpost.
Returns a byte array containing the rendered image produced using the provided size, format and
renderSettings. The value may be null if the signpost could not be rendered with the requested parameters.
Which image is rendered?
When this handle's signpost image matches the one carried by the
currently-active navigation instruction (as reported by
NavigationService.getNavigationInstruction()), the native method
parser renders from the live instruction rather than from the cached
SignpostDetails this call was made on. This shields callers from
use-after-free when the engine replaces the active instruction
(next step, rematch, route recalculation, arrival) and the cached
native memory behind the Dart handle is recycled. When the handle
does not correspond to the live instruction (route preview, static
route-instruction list, off-map inspection) rendering uses this
SignpostDetails as before.
Parameters
size: Optional desired image size. When omitted the SDK default size is used.format: Optional image file format. When omitted an appropriate default (PNG) is used.renderSettings: Rendering options to control border, corner rounding and maximum rows.allowResize: Whentruethe SDK may choose a suitable size based on the provided height; otherwise the requested size is used as-is.
Returns
Uint8List?: the image bytes when available, otherwisenull.
See also:
- SignpostImg — image helpers for signpost rendering.
Implementation
Uint8List? getImage({
final Size? size,
final ImageFileFormat? format,
final SignpostImageRenderSettings renderSettings =
const SignpostImageRenderSettings(),
final bool allowResize = false,
}) {
return GemKitPlatform.instance.callGetImage(
pointerId,
'SignPostDetailsGetImage',
size?.width.toInt() ?? -1,
size?.height.toInt() ?? -1,
format?.id ?? -1,
arg: jsonEncode(renderSettings),
allowResize: allowResize,
);
}