Skip to content
pubscout

amazon_cognito_identity_dart_2

4.0.1, released 3 months ago by an unverified publisher

Unofficial Amazon Cognito Identity Provider SDK for Dart and Flutter apps.

WASM-readyUnverified publisher
$ flutter pub add amazon_cognito_identity_dart_2
Source repository

What it does

Provides an unofficial client library for Amazon Cognito Identity to handle user sign-up, sign-in, sessions, and MFA in Dart and Flutter applications. It is based on amazon-cognito-identity-js.

AI-written summary of version 4.0.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to authenticate users using AWS Cognito in a Flutter or Dart app.
  • You want an alternative to Amplify Flutter specifically for Cognito Identity management.

Skip it when

  • You prefer using official and fully supported AWS plugins like Amplify Flutter.
  • Your project does not use Amazon Cognito as an identity provider.

Strengths

  • Supports a wide range of Cognito features including MFA, custom challenges, and refresh token rotation.
  • Works across multiple platforms including Android, iOS, Web, Windows, macOS, and Linux.

Weaknesses

  • It is an unofficial SDK, meaning it might lag behind official AWS updates.
  • Official AWS support recommends using Amplify Flutter instead.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
4

Requires setting up an AWS Cognito User Pool and Client ID, then initializing the CognitoUserPool object.

import 'package:amazon_cognito_identity_dart_2/cognito.dart';

final userPool = CognitoUserPool(
  'ap-southeast-1_xxxxxxxxx',
  'xxxxxxxxxxxxxxxxxxxxxxxxxx',
);
final userAttributes = [
  AttributeArg(name: 'first_name', value: 'Jimmy'),
  AttributeArg(name: 'last_name', value: 'Wong'),
];

try {
  var data = await userPool.signUp(
    'email@inspire.my',
    'Password001',
    userAttributes: userAttributes,
  );
} catch (e) {
  print(e);
}

Alternatives

Packages that do the same job and could replace amazon_cognito_identity_dart_2.

Works with

Packages commonly used together with amazon_cognito_identity_dart_2: ones it builds on, ones built on it, and its own family.