fromJson static method

PartenaireToWalletModel? fromJson(
  1. dynamic value
)

Returns a new PartenaireToWalletModel instance and imports its values from value if it's a Map, null otherwise.

Implementation

// ignore: prefer_constructors_over_static_methods
static PartenaireToWalletModel? 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(() {
      requiredKeys.forEach((key) {
        assert(json.containsKey(key), 'Required key "PartenaireToWalletModel[$key]" is missing from JSON.');
        assert(json[key] != null, 'Required key "PartenaireToWalletModel[$key]" has a null value in JSON.');
      });
      return true;
    }());

    return PartenaireToWalletModel(
      phoneClient: mapValueOfType<String>(json, r'phoneClient'),
      montantTransaction: mapValueOfType<double>(json, r'montantTransaction'),
      longTransaction: mapValueOfType<String>(json, r'longTransaction'),
      latTransaction: mapValueOfType<String>(json, r'latTransaction'),
      motifTransaction: mapValueOfType<String>(json, r'motifTransaction'),
      requestId: mapValueOfType<String>(json, r'requestId'),
      adresseIp: mapValueOfType<String>(json, r'adresseIp'),
      phoneDeposant: mapValueOfType<String>(json, r'phoneDeposant'),
      nomDeposant: mapValueOfType<String>(json, r'nomDeposant'),
      prenomDeposant: mapValueOfType<String>(json, r'prenomDeposant'),
      typePieceDeposant: mapValueOfType<String>(json, r'typePieceDeposant'),
      numeroPieceDeposant: mapValueOfType<String>(json, r'numeroPieceDeposant'),
    );
  }
  return null;
}