getGenericToJsonFn function

Object? Function(Never) getGenericToJsonFn(
  1. Map<Type, Object? Function(Never)> fns,
  2. Type type
)

Resolves a generic toJson function for the provided type.

Implementation

Object? Function(Never) getGenericToJsonFn(
  Map<Type, Object? Function(Never)> fns,
  Type type,
) {
  var type1_fn = fns[type];

  if (type1_fn == null) //
    return (x) => x;

  return type1_fn;
}