tryParse static method

SSO? tryParse(
  1. String? id
)

The member for an API provider id, or null when this build predates it.

Returning null rather than throwing matters: a server may name a provider added after this app shipped, and an unknown one should degrade to "we cannot offer that here" rather than taking the sign-in screen down.

Implementation

static SSO? tryParse(String? id) {
  for (final provider in SSO.values) {
    if (provider.id == id) return provider;
  }
  return null;
}