getObj<T> static method

T? getObj<T>(
  1. String? source,
  2. T f(
    1. Map v
    )
)

Converts JSON string source to object.

Implementation

static T? getObj<T>(String? source, T Function(Map v) f) {
  if (source == null || source.isEmpty) return null;
  try {
    Map map = json.decode(source);
    return f(map);
  } catch (e) {
    print('JsonUtil convert error, Exception:${e.toString()}');
  }
  return null;
}