Name:
interface
Value:
Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.

Page updated Apr 29, 2024

Listen to auth events

AWS Cognito Auth Plugin sends important events through Amplify Hub.

Amplify Flutter v1 is deprecated as of April 30th, 2025. No new features or bug fixes will be added. Dependencies may become outdated and potentially introduce compatibility issues.

Please use the latest version (v2) of Amplify Flutter to get started.

If you are currently using v1, follow these instructions to upgrade to v2.

final subscription = Amplify.Hub.listen(HubChannel.Auth, (AuthHubEvent event) {
switch (event.type) {
case AuthHubEventType.signedIn:
safePrint('User is signed in.');
break;
case AuthHubEventType.signedOut:
safePrint('User is signed out.');
break;
case AuthHubEventType.sessionExpired:
safePrint('The session has expired.');
break;
case AuthHubEventType.userDeleted:
safePrint('The user has been deleted.');
break;
}
});