fromJson static method
Returns a new WalletTransferRequest instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static WalletTransferRequest? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
// Ensure that the map contains the required keys.
// Note 1: the values aren't checked for validity beyond being non-null.
// Note 2: this code is stripped in release mode!
assert(() {
assert(json.containsKey(r'fromWalletId'), 'Required key "WalletTransferRequest[fromWalletId]" is missing from JSON.');
assert(json[r'fromWalletId'] != null, 'Required key "WalletTransferRequest[fromWalletId]" has a null value in JSON.');
assert(json.containsKey(r'toWalletId'), 'Required key "WalletTransferRequest[toWalletId]" is missing from JSON.');
assert(json[r'toWalletId'] != null, 'Required key "WalletTransferRequest[toWalletId]" has a null value in JSON.');
assert(json.containsKey(r'amount'), 'Required key "WalletTransferRequest[amount]" is missing from JSON.');
assert(json[r'amount'] != null, 'Required key "WalletTransferRequest[amount]" has a null value in JSON.');
return true;
}());
return WalletTransferRequest(
fromWalletId: mapValueOfType<String>(json, r'fromWalletId')!,
toWalletId: mapValueOfType<String>(json, r'toWalletId')!,
amount: num.parse('${json[r'amount']}'),
);
}
return null;
}