renderBitmap method

  1. @override
void renderBitmap(
  1. MapCanvas flutterCanvas,
  2. MarkerContext markerContext
)
override

renders the bitmap portion of this marker. This method is called by render() which also call the render method for the caption

Implementation

@override
void renderBitmap(MapCanvas flutterCanvas, MarkerContext markerContext) {
  final iconPosition = Offset(
    (mappoint.x - markerContext.mapCenter.x),
    (mappoint.y - markerContext.mapCenter.y),
  );

  TextPainter textPainter = TextPainter(
    text: TextSpan(
      text: String.fromCharCode(icon.codePoint),
      style: TextStyle(
        fontSize: fontSize,
        fontFamily: icon.fontFamily,
        color: color,
        shadows: shadows,
      ),
    ),
    textDirection: TextDirection.ltr,
  );
  textPainter.layout();

  textPainter.paint((flutterCanvas as FlutterCanvas).uiCanvas, iconPosition);
}