decode static method

PendingAuthorization? decode(
  1. String? raw
)

The record encode wrote, or null when raw is not one.

Implementation

static PendingAuthorization? decode(String? raw) {
  if (raw == null || raw.isEmpty) return null;
  try {
    final j = jsonDecode(raw);
    if (j is! Map) return null;
    return PendingAuthorization(
      resource: j['resource'] as String,
      issuer: j['issuer'] as String,
      issParameterSupported: j['iss_supported'] as bool,
      tokenEndpoint: j['token_endpoint'] as String,
      clientId: j['client_id'] as String,
      redirectUri: j['redirect_uri'] as String,
      state: j['state'] as String,
      codeVerifier: j['code_verifier'] as String,
      scopes: [for (final s in j['scopes'] as List) '$s'],
    );
  } on Object {
    return null;
  }
}