tryToJson<T> static method
Converts a JSON-encoded string to a Dart object represented as a Map if possible.
The input data
is a JSON-encoded string.
Returns a Map representing the Dart object.
Implementation
static T? tryToJson<T>(Object? data,
{Object? Function(Object?, Object?)? reviver}) {
try {
return toJson<T>(data, reviver: reviver);
} catch (_) {
return null;
}
}