flutter_lwa 0.1.0

flutter_lwa #

pub package Build Status Coverage Status

A Flutter plugin for using Login with Amazon on Android and iOS.

Installation #

In addition to adding a pubspec dependency, this plugin requires Login with Amazon setup which requires modification of the native Android and iOS code of your flutter application.

Add a dependency to your pubspec.yml file #

See the installation instructions on pub.

Login with Amazon #

Register for Login with Amazon access and create API keys for Android and iOS as described in the documentation.

Android #

  1. Create a Login with Amazon API key for Android.

  2. Create a text file located at {project_root}/android/app/main/assets/api_key.txt

  3. Copy-paste the contents of the API key from the Login with Amazon console into the file {project_root}/android/app/main/assets/api_key.txt


iOS #

  1. Create a Login with Amazon API key for iOS.

  2. Add the APIKey key to the iOS properties file located at {project_root}/ios/Runner/Info.plist. The {api_key} should be the API key copy-pasted from the Login with Amazon console.

  1. Add the CFBundleURLTypes key to the iOS properties file located at {project_root}/ios/Runner/Info.plist. The {bundle_id} should be the bundle identifier of your application. (Example of a bundle id: com.github.ayvazj.example)
  1. Update {project_root}/ios/Runner/AppDelegate.m to add the #import <LoginWithAmazon/LoginWithAmazon.h> import statement as well as the (BOOL)application:(UIApplication *)application openURL:(NSURL *) url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options method.

#import <LoginWithAmazon/LoginWithAmazon.h>

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application openURL:(NSURL *) url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
    return [AMZNAuthorizationManager handleOpenURL:url



A sample of a complete Info.plist file can be found here.


How do I use it? #

The plugin follows the same patterns as the Google Signin API to make integration simple. For a complete sample see the example application.

import 'package:flutter_lwa/lwa.dart';

LoginWithAmazon _loginWithAmazon = LoginWithAmazon(
  scopes: <Scope>[ProfileScope.profile(), ProfileScope.postalCode()],

class _MyAppState extends State<MyApp> {
  LwaAuthorizeResult _lwaAuth;

  void initState() {
    _loginWithAmazon.onLwaAuthorizeChanged.listen((LwaAuthorizeResult auth) {
      setState(() {
        _lwaAuth = auth;

  Future<void> _handleSignIn(BuildContext context) async {
    try {
      await _loginWithAmazon.signin();
    } catch (error) {
      if (error is PlatformException) {
          content: Text("${error.message}"),
      } else {
          content: Text(error.toString()),

  Future<void> _handleSignOut() => _loginWithAmazon.signOut();

0.1.0 #

  • Initial release.


lwa_example #

Demonstrates how to use the flutter_lwa plugin.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  flutter_lwa: ^0.1.0

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:flutter_lwa/generated/i18n.dart';
import 'package:flutter_lwa/lwa.dart';
import 'package:flutter_lwa/scope.dart';
import 'package:flutter_lwa/widgets.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Feb 19, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5
  • Flutter: 1.12.13+hotfix.7

Health suggestions

Fix lib/lwa.dart. (-0.50 points)

Analysis of lib/lwa.dart reported 1 hint:

line 292 col 10: The declaration 'isCanceled' isn't referenced.

Format lib/generated/i18n.dart.

Run flutter format to format lib/generated/i18n.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies