getIdentityId method

Future<String?> getIdentityId()

Implementation

Future<String?> getIdentityId() async {
  var identityId = await _pool.storage.getItem(_identityIdKey);
  if (identityId != null) {
    this.identityId = identityId;
    return identityId;
  }

  final paramsReq = <String, dynamic>{'IdentityPoolId': _identityPoolId};

  if (_loginParam != null) {
    paramsReq['Logins'] = _loginParam;
  }

  final data = await _client!.request('GetId', paramsReq,
      service: 'AWSCognitoIdentityService',
      endpoint: 'https://cognito-identity.$_region.amazonaws.com/');

  this.identityId = data['IdentityId'];
  await _pool.storage.setItem(_identityIdKey, this.identityId);

  return this.identityId;
}