decode<T> static method
Decodes an optional value from JSON maps or method channel results.
value - The value to decode (typically json[key] or a method channel result).
fromJson - Optional function to decode objects. If not provided, value is cast directly.
Implementation
static T? decode<T>(dynamic value, [T Function(Map)? fromJson]) {
if (value == null) return null;
if (fromJson != null) {
return fromJson(value as Map);
}
return value as T?;
}