getContext method

CanvasRenderingContext2D getContext(
  1. String type, {
  2. dynamic options,
})

Implementation

CanvasRenderingContext2D getContext(String type, { options }) {
  switch (type) {
    case '2d':
      if (painter.context == null) {
        context2d ??= CanvasRenderingContext2D(this);
        painter.context = context2d;
      }
      return painter.context!;
    default:
      throw FlutterError('CanvasRenderingContext $type not supported!');
  }
}