fromJson method

  1. @override
Offset fromJson(
  1. Object? json
)

Implementation

@override
Offset fromJson(Object? json) {
  if (json is Map<String, dynamic>) {
    final x = json['x'];
    final y = json['y'];
    return Offset(
      x is num ? x.toDouble() : 0.0,
      y is num ? y.toDouble() : 0.0,
    );
  }
  return Offset.zero;
}