from static method

PCanvasElement2D? from(
  1. Object? o
)
override

Implementation

static PCanvasElement2D? from(Object? o) {
  if (o == null) return null;
  if (o is PCanvasElement2D) return o;

  if (o is PCanvasElement) {
    throw StateError("Type `${o.className}` is NOT a `PCanvasElement2D`: $o");
  }

  if (o is Map<String, dynamic>) {
    return PCanvasElement2D.fromJson(o);
  }

  return null;
}