Position.fromJson constructor

Position.fromJson(
  1. Map<String, dynamic> j
)

Implementation

factory Position.fromJson(Map<String, dynamic> j) {
  final className = j['className'] as String;

  switch (className) {
    case 'Point':
    case 'DynamicPosition':
    case 'DynamicElementPosition':
      return Point.fromJson(j);
    default:
      throw StateError("Can't handle JSON with `className`: $className");
  }
}