decode static method

LocalSecret? decode(
  1. Unpacker u
)

Implementation

static LocalSecret? decode(Unpacker u) {
  try {
    switch (u.unpackString()) {
      case null: return null;
      default: throw DecodeError();
    }
  } on FormatException {
    if (u.unpackMapLength() != 1) throw DecodeError();
    switch (u.unpackString()) {
      case "Password":
        return LocalSecretPassword(
          (Password.decode(u))!,
        );
      case "SecretKey":
        return LocalSecretSecretKey(
          (SecretKey.decode(u))!,
        );
      case null: return null;
      default: throw DecodeError();
    }
  }
}