Position.fromJson constructor
Position.fromJson(
- dynamic json
Either String or Map<String, dynamic>
Implementation
factory Position.fromJson(dynamic json) {
assert(json != null, 'JSON cannot be null');
assert(
json is String || json is Map<String, dynamic>,
'Invalid JSON format for Position',
);
json = (json is String ? jsonDecode(json) : json) as Map<String, dynamic>;
assert(
json['row'] != null && json['col'] != null,
'row or col cannot be null in JSON format for Position',
);
return Position(row: json['row']!, col: json['col']!);
}