fromLegacyEntry static method

AuthyoSocialLogin? fromLegacyEntry(
  1. String entry
)

Parses the legacy "Google,123" / "GoogleOneTap,5*clientId" entries the web CDN endpoint mixes into its results array. Returns null for plain auth-method entries such as "Sms".

Implementation

static AuthyoSocialLogin? fromLegacyEntry(String entry) {
  final comma = entry.indexOf(',');
  if (comma <= 0) return null;
  final name = entry.substring(0, comma);
  var id = entry.substring(comma + 1);
  final star = id.indexOf('*');
  if (star >= 0) id = id.substring(0, star);
  final provider = AuthyoSocialProvider.fromName(name);
  // GoogleOneTap is a browser-only flow.
  if (provider == AuthyoSocialProvider.unknown) return null;
  return AuthyoSocialLogin(provider: provider, id: id);
}