toJSON method Null safety

  1. @override
dynamic toJSON(
  1. Object? object,
  2. [SerializationContext? context]
)
override

Implementation

@override
dynamic toJSON(Object? object, [SerializationContext? context]) {
  dynamic convert(value) => value.toString();
  return (object is Iterable)
      ? object.map(convert).toList()
      : convert(object);
}