CognitoUserPool constructor

CognitoUserPool(
  1. String userPoolId,
  2. String clientId, {
  3. String? clientSecret,
  4. String? endpoint,
  5. Client? customClient,
  6. String? customUserAgent,
  7. CognitoStorage? storage,
  8. bool advancedSecurityDataCollectionFlag = true,
  9. 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();
}