CognitoUserPool constructor
CognitoUserPool(
- String userPoolId,
- String clientId, {
- String? clientSecret,
- String? endpoint,
- Client? customClient,
- String? customUserAgent,
- CognitoStorage? storage,
- bool advancedSecurityDataCollectionFlag = true,
- ParamsDecorator? analyticsMetadataParamsDecorator,
Implementation
CognitoUserPool(
String userPoolId,
String clientId, {
String? clientSecret,
String? endpoint,
Client? customClient,
String? customUserAgent,
CognitoStorage? storage,
this.advancedSecurityDataCollectionFlag = true,
ParamsDecorator? analyticsMetadataParamsDecorator,
}) : _analyticsMetadataParamsDecorator =
analyticsMetadataParamsDecorator ?? NoOpsParamsDecorator() {
_userPoolId = userPoolId;
_clientId = clientId;
_clientSecret = clientSecret;
final regExp = RegExp(r'^[\w-]+_.+$');
if (!regExp.hasMatch(userPoolId)) {
throw ArgumentError('Invalid userPoolId format.');
}
_region = userPoolId.split('_')[0];
_userAgent = customUserAgent;
client = Client(region: _region, endpoint: endpoint, userAgent: _userAgent);
if (customClient != null) {
client = customClient;
}
this.storage =
storage ?? (CognitoStorageHelper(CognitoMemoryStorage())).getStorage();
}