Mechanism.fromJson constructor

Mechanism.fromJson(
  1. Map<String, dynamic> json, [
  2. Account? account
])

Deserializes the specified Json into an object of the Mechanism object.

Implementation

factory Mechanism.fromJson(Map<String, dynamic> json, [Account? account]) {
  if (json['type'] == PUSH) {
    return PushMechanism.fromJson(json, account);
  } else if (json['type'] == OATH) {
    return OathMechanism.fromJson(json, account);
  } else {
    return Mechanism(
        json['id'],
        json['mechanismUID'],
        json['issuer'],
        json['accountName'],
        json['type'],
        json['secret'],
        json['timeAdded'],
        account);
  }
}