toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  final result = {'name': name};
  if (weight != null) {
    result['weight'] = weight!;
  }
  return result;
}