named static method
For a given name return the Strategy it identifies.
Create one if necessary and possible
Implementation
static Strategy? named(dynamic name) {
if (name case String name) {
switch (_strategies[name]) {
case Strategy strategy:
return strategy;
case null when name.startsWith(_oauthToken):
return _strategies[name] = Strategy(
name: _oauthToken,
provider: name.substring(_oauthToken.length + 1),
);
case null when name.startsWith(_oauthCustom):
return _strategies[name] = Strategy(
name: _oauthCustom,
provider: name.substring(_oauthCustom.length + 1),
);
case null when name.startsWith(_oauth):
return _strategies[name] = Strategy(
name: _oauth,
provider: name.substring(_oauth.length + 1),
);
default:
return null;
}
}
return null;
}