├── android
├── gradle.properties
├── app
│ ├── src
│ │ ├── main
│ │ │ ├── res
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── values
│ │ │ │ │ └── styles.xml
│ │ │ │ └── drawable
│ │ │ │ │ └── launch_background.xml
│ │ │ ├── kotlin
│ │ │ │ └── com
│ │ │ │ │ └── example
│ │ │ │ │ └── flutter_aws_app
│ │ │ │ │ └── MainActivity.kt
│ │ │ └── AndroidManifest.xml
│ │ ├── debug
│ │ │ └── AndroidManifest.xml
│ │ └── profile
│ │ │ └── AndroidManifest.xml
│ └── build.gradle
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
├── settings.gradle
└── build.gradle
├── ios
├── Flutter
│ ├── Debug.xcconfig
│ ├── Release.xcconfig
│ └── AppFrameworkInfo.plist
├── Runner
│ ├── Runner-Bridging-Header.h
│ ├── Assets.xcassets
│ │ ├── LaunchImage.imageset
│ │ │ ├── LaunchImage.png
│ │ │ ├── LaunchImage@2x.png
│ │ │ ├── LaunchImage@3x.png
│ │ │ ├── README.md
│ │ │ └── Contents.json
│ │ └── AppIcon.appiconset
│ │ │ ├── Icon-App-20x20@1x.png
│ │ │ ├── Icon-App-20x20@2x.png
│ │ │ ├── Icon-App-20x20@3x.png
│ │ │ ├── Icon-App-29x29@1x.png
│ │ │ ├── Icon-App-29x29@2x.png
│ │ │ ├── Icon-App-29x29@3x.png
│ │ │ ├── Icon-App-40x40@1x.png
│ │ │ ├── Icon-App-40x40@2x.png
│ │ │ ├── Icon-App-40x40@3x.png
│ │ │ ├── Icon-App-60x60@2x.png
│ │ │ ├── Icon-App-60x60@3x.png
│ │ │ ├── Icon-App-76x76@1x.png
│ │ │ ├── Icon-App-76x76@2x.png
│ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ ├── Icon-App-83.5x83.5@2x.png
│ │ │ └── Contents.json
│ ├── AppDelegate.swift
│ ├── Info.plist
│ └── Base.lproj
│ │ ├── Main.storyboard
│ │ └── LaunchScreen.storyboard
├── Runner.xcworkspace
│ └── contents.xcworkspacedata
└── Runner.xcodeproj
│ ├── project.xcworkspace
│ └── contents.xcworkspacedata
│ ├── xcshareddata
│ └── xcschemes
│ │ └── Runner.xcscheme
│ └── project.pbxproj
├── lib
├── models
│ ├── models.dart
│ ├── pet.dart
│ ├── query.dart
│ ├── serializers.dart
│ ├── serializers.g.dart
│ ├── pet.g.dart
│ └── query.g.dart
├── packages
│ ├── repository.dart
│ ├── query_repository.dart
│ ├── repository_provider.dart
│ ├── repository_provider_tree.dart
│ ├── query_provider.dart
│ └── sig_v4.dart
├── home
│ ├── home.dart
│ ├── home_events.dart
│ ├── home_states.dart
│ ├── home_bloc.dart
│ ├── home_events.g.dart
│ ├── home_states.g.dart
│ └── home_page.dart
├── identity
│ ├── identity.dart
│ ├── identity_signout_page.dart
│ ├── identity_signin_page.dart
│ └── identity_repository.dart
├── authentication
│ ├── authentication.dart
│ ├── authentication_events.dart
│ ├── authentication_states.dart
│ ├── authentication_tokens.dart
│ ├── authentication_credentials.dart
│ ├── authentication_bloc.dart
│ ├── authentication_states.g.dart
│ └── authentication_events.g.dart
└── main.dart
├── .metadata
├── test
└── widget_test.dart
├── README.md
├── .gitignore
├── pubspec.yaml
└── pubspec.lock
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 |
--------------------------------------------------------------------------------
/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
--------------------------------------------------------------------------------
/lib/models/models.dart:
--------------------------------------------------------------------------------
1 | export 'serializers.dart';
2 | export 'pet.dart';
3 | export 'query.dart';
4 |
--------------------------------------------------------------------------------
/lib/packages/repository.dart:
--------------------------------------------------------------------------------
1 | export 'repository_provider.dart';
2 | export 'repository_provider_tree.dart';
--------------------------------------------------------------------------------
/lib/home/home.dart:
--------------------------------------------------------------------------------
1 | export 'home_bloc.dart';
2 | export 'home_events.dart';
3 | export 'home_states.dart';
4 | export 'home_page.dart';
--------------------------------------------------------------------------------
/lib/identity/identity.dart:
--------------------------------------------------------------------------------
1 | export 'identity_repository.dart';
2 | export 'identity_signin_page.dart';
3 | export 'identity_signout_page.dart';
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BerndWessels/flutter_aws_app/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BerndWessels/flutter_aws_app/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BerndWessels/flutter_aws_app/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BerndWessels/flutter_aws_app/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BerndWessels/flutter_aws_app/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BerndWessels/flutter_aws_app/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BerndWessels/flutter_aws_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BerndWessels/flutter_aws_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BerndWessels/flutter_aws_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BerndWessels/flutter_aws_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BerndWessels/flutter_aws_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BerndWessels/flutter_aws_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BerndWessels/flutter_aws_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BerndWessels/flutter_aws_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BerndWessels/flutter_aws_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BerndWessels/flutter_aws_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BerndWessels/flutter_aws_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BerndWessels/flutter_aws_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BerndWessels/flutter_aws_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BerndWessels/flutter_aws_app/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BerndWessels/flutter_aws_app/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BerndWessels/flutter_aws_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BerndWessels/flutter_aws_app/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/lib/authentication/authentication.dart:
--------------------------------------------------------------------------------
1 | export 'authentication_bloc.dart';
2 | export 'authentication_events.dart';
3 | export 'authentication_states.dart';
4 | export 'authentication_tokens.dart';
5 | export 'authentication_credentials.dart';
6 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
7 |
--------------------------------------------------------------------------------
/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: 8661d8aecd626f7f57ccbcb735553edc05a2e713
8 | channel: stable
9 |
10 | project_type: app
11 |
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/flutter_aws_app/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.flutter_aws_app
2 |
3 | import android.os.Bundle
4 |
5 | import io.flutter.app.FlutterActivity
6 | import io.flutter.plugins.GeneratedPluginRegistrant
7 |
8 | class MainActivity: FlutterActivity() {
9 | override fun onCreate(savedInstanceState: Bundle?) {
10 | super.onCreate(savedInstanceState)
11 | GeneratedPluginRegistrant.registerWith(this)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 |
4 | @UIApplicationMain
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/lib/models/pet.dart:
--------------------------------------------------------------------------------
1 | import 'package:built_collection/built_collection.dart';
2 | import 'package:built_value/built_value.dart';
3 | import 'package:built_value/serializer.dart';
4 |
5 | part 'pet.g.dart';
6 |
7 | abstract class Pet implements Built {
8 | static Serializer get serializer => _$petSerializer;
9 |
10 | Pet._();
11 |
12 | factory Pet([void Function(PetBuilder) updates]) = _$Pet;
13 |
14 | String get id;
15 |
16 | String get type;
17 |
18 | double get price;
19 | }
20 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
4 |
5 | def plugins = new Properties()
6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
7 | if (pluginsFile.exists()) {
8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
9 | }
10 |
11 | plugins.each { name, path ->
12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
13 | include ":$name"
14 | project(":$name").projectDir = pluginDirectory
15 | }
16 |
--------------------------------------------------------------------------------
/test/widget_test.dart:
--------------------------------------------------------------------------------
1 | // This is a basic Flutter widget test.
2 | //
3 | // To perform an interaction with a widget in your test, use the WidgetTester
4 | // utility that Flutter provides. For example, you can send tap and scroll
5 | // gestures. You can also use WidgetTester to find child widgets in the widget
6 | // tree, read text, and verify that the values of widget properties are correct.
7 |
8 | import 'package:flutter_test/flutter_test.dart';
9 |
10 | void main() {
11 | testWidgets('Counter increments smoke test', (WidgetTester tester) async {});
12 | }
13 |
--------------------------------------------------------------------------------
/lib/models/query.dart:
--------------------------------------------------------------------------------
1 | import 'package:built_collection/built_collection.dart';
2 | import 'package:built_value/built_value.dart';
3 | import 'package:built_value/serializer.dart';
4 |
5 | import 'models.dart';
6 |
7 | part 'query.g.dart';
8 |
9 | abstract class Query implements Built {
10 | static Serializer get serializer => _$querySerializer;
11 |
12 | Query._();
13 |
14 | factory Query([void Function(QueryBuilder) updates]) = _$Query;
15 |
16 | @nullable
17 | Pet get getPet;
18 |
19 | @nullable
20 | BuiltList get listPets;
21 | }
22 |
--------------------------------------------------------------------------------
/lib/home/home_events.dart:
--------------------------------------------------------------------------------
1 | import 'package:built_value/built_value.dart';
2 |
3 | part 'home_events.g.dart';
4 |
5 | abstract class HomeEvent {}
6 |
7 | abstract class Fetch implements Built, HomeEvent {
8 | Fetch._();
9 |
10 | factory Fetch([void Function(FetchBuilder) updates]) = _$Fetch;
11 |
12 | String get operationName;
13 |
14 | String get query;
15 | }
16 |
17 | abstract class Initialize
18 | implements Built, HomeEvent {
19 | Initialize._();
20 |
21 | factory Initialize([void Function(InitializeBuilder) updates]) = _$Initialize;
22 | }
23 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.2.71'
3 | repositories {
4 | google()
5 | jcenter()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:3.2.1'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | jcenter()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 | subprojects {
26 | project.evaluationDependsOn(':app')
27 | }
28 |
29 | task clean(type: Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/lib/models/serializers.dart:
--------------------------------------------------------------------------------
1 | import 'package:built_collection/built_collection.dart';
2 | import 'package:built_value/serializer.dart';
3 | import 'package:built_value/standard_json_plugin.dart';
4 | import 'package:flutter_aws_app/models/models.dart';
5 |
6 | part 'serializers.g.dart';
7 |
8 | @SerializersFor([
9 | Query,
10 | Pet,
11 | ])
12 | final Serializers serializers = _$serializers;
13 |
14 | //final Serializers serializers = (_$serializers.toBuilder()
15 | // ..addBuilderFactory(
16 | // const FullType(BuiltList, const [const FullType(Pet)]),
17 | // () => new ListBuilder()))
18 | // .build();
19 |
20 | final standardSerializers =
21 | (serializers.toBuilder()..addPlugin(StandardJsonPlugin())).build();
22 |
--------------------------------------------------------------------------------
/lib/home/home_states.dart:
--------------------------------------------------------------------------------
1 | import 'package:built_value/built_value.dart';
2 |
3 | part 'home_states.g.dart';
4 |
5 | abstract class HomeState {}
6 |
7 | abstract class HomeInitial
8 | implements Built, HomeState {
9 | HomeInitial._();
10 |
11 | factory HomeInitial([void Function(HomeInitialBuilder) updates]) =
12 | _$HomeInitial;
13 | }
14 |
15 | abstract class HomeSuccess
16 | implements Built, HomeState {
17 | HomeSuccess._();
18 |
19 | factory HomeSuccess([void Function(HomeSuccessBuilder) updates]) =
20 | _$HomeSuccess;
21 | }
22 |
23 | abstract class HomeLoading
24 | implements Built, HomeState {
25 | HomeLoading._();
26 |
27 | factory HomeLoading([void Function(HomeLoadingBuilder) updates]) =
28 | _$HomeLoading;
29 | }
30 |
--------------------------------------------------------------------------------
/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 8.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/lib/authentication/authentication_events.dart:
--------------------------------------------------------------------------------
1 | import 'package:built_value/built_value.dart';
2 |
3 | part 'authentication_events.g.dart';
4 |
5 | abstract class AuthenticationEvent {}
6 |
7 | abstract class AppStarted
8 | implements Built, AuthenticationEvent {
9 | AppStarted._();
10 |
11 | factory AppStarted([void Function(AppStartedBuilder) updates]) = _$AppStarted;
12 | }
13 |
14 | abstract class Authenticate
15 | implements Built, AuthenticationEvent {
16 | Authenticate._();
17 |
18 | factory Authenticate([void Function(AuthenticateBuilder) updates]) =
19 | _$Authenticate;
20 |
21 | String get code;
22 | }
23 |
24 | abstract class SignOut
25 | implements Built, AuthenticationEvent {
26 | SignOut._();
27 |
28 | factory SignOut([void Function(SignOutBuilder) updates]) = _$SignOut;
29 | }
30 |
--------------------------------------------------------------------------------
/lib/models/serializers.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'serializers.dart';
4 |
5 | // **************************************************************************
6 | // BuiltValueGenerator
7 | // **************************************************************************
8 |
9 | Serializers _$serializers = (new Serializers().toBuilder()
10 | ..add(Pet.serializer)
11 | ..add(Query.serializer)
12 | ..addBuilderFactory(
13 | const FullType(BuiltList, const [const FullType(Pet)]),
14 | () => new ListBuilder()))
15 | .build();
16 |
17 | // ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,lines_longer_than_80_chars,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new
18 |
--------------------------------------------------------------------------------
/lib/authentication/authentication_states.dart:
--------------------------------------------------------------------------------
1 | import 'package:built_value/built_value.dart';
2 |
3 | part 'authentication_states.g.dart';
4 |
5 | abstract class AuthenticationState {}
6 |
7 | abstract class Authenticated
8 | implements Built, AuthenticationState {
9 | Authenticated._();
10 |
11 | factory Authenticated([void Function(AuthenticatedBuilder) updates]) =
12 | _$Authenticated;
13 | }
14 |
15 | abstract class Unauthenticated
16 | implements
17 | Built,
18 | AuthenticationState {
19 | Unauthenticated._();
20 |
21 | factory Unauthenticated([void Function(UnauthenticatedBuilder) updates]) =
22 | _$Unauthenticated;
23 | }
24 |
25 | abstract class Uninitialized
26 | implements Built, AuthenticationState {
27 | Uninitialized._();
28 |
29 | factory Uninitialized([void Function(UninitializedBuilder) updates]) =
30 | _$Uninitialized;
31 | }
32 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # flutter_aws_app
2 |
3 | A simple Flutter example app showing how to use
4 | - AWS Cognito User Management
5 | - AWS AppSync GraphQL API
6 | with Flutter
7 |
8 | This Example uses the AWS Cognito hosted UI to manage all users including federated identities
9 | within the Cognito User Pool.
10 |
11 | It is still using a Cognito Identity Pool to get IAM access credentials.
12 |
13 | To get a better understanding checkout the following links.
14 |
15 | ## More Details
16 |
17 | - [BFF Back-End for Front-End Architecture](https://medium.com/@wesselsbernd/bff-back-end-for-front-end-architecture-as-of-may-2019-5d09b913a8ed)
18 | - [Some AWS Cognito & AppSync Details](https://medium.com/@wesselsbernd/some-aws-cognito-appsync-details-as-of-may-2019-247c8531f600)
19 | - [Flutter and AWS](https://medium.com/@wesselsbernd/flutter-and-aws-as-of-march-2019-1ad7f40fa9e4)
20 |
21 | ## Changelog
22 |
23 | ### 2019 / 05 / 31
24 | - Cleanup
25 | - Better organized into blocs, repositories and providers
26 | - Now using BuiltValue and BuiltCollection
27 |
--------------------------------------------------------------------------------
/lib/authentication/authentication_tokens.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 |
3 | class AuthenticationTokens {
4 | final String accessToken;
5 | final String refreshToken;
6 | final String idToken;
7 | final DateTime expiryDateTime;
8 |
9 | AuthenticationTokens({
10 | this.accessToken,
11 | this.expiryDateTime,
12 | this.idToken,
13 | this.refreshToken,
14 | });
15 |
16 | factory AuthenticationTokens.fromJson(String json) {
17 | Map data = jsonDecode(json, reviver: (key, value) {
18 | return key == "expiryDateTime" ? DateTime.parse(value) : value;
19 | });
20 | return AuthenticationTokens(
21 | accessToken: data["accessToken"],
22 | refreshToken: data["refreshToken"],
23 | idToken: data["idToken"],
24 | expiryDateTime: data["expiryDateTime"],
25 | );
26 | }
27 |
28 | String toJson() {
29 | return jsonEncode({
30 | "accessToken": accessToken,
31 | "refreshToken": refreshToken,
32 | "idToken": idToken,
33 | "expiryDateTime": expiryDateTime.toIso8601String()
34 | });
35 | }
36 |
37 | bool get hasExpired => DateTime.now().isAfter(expiryDateTime);
38 | }
39 |
--------------------------------------------------------------------------------
/lib/home/home_bloc.dart:
--------------------------------------------------------------------------------
1 | import 'package:bloc/bloc.dart';
2 | import 'package:flutter_aws_app/home/home.dart';
3 | import 'package:flutter_aws_app/packages/query_repository.dart';
4 | import 'package:meta/meta.dart';
5 |
6 | class HomeBloc extends Bloc {
7 | final QueryRepository queryRepository;
8 |
9 | HomeBloc({@required this.queryRepository}) : assert(queryRepository != null);
10 |
11 | @override
12 | HomeState get initialState => HomeInitial();
13 |
14 | @override
15 | Stream mapEventToState(
16 | HomeEvent event,
17 | ) async* {
18 | if (event is Initialize) {
19 | yield HomeLoading();
20 | var response = await queryRepository.query(
21 | """
22 | listPets {
23 | id
24 | price
25 | type
26 | }
27 | """,
28 | retryCount: 2,
29 | ); // , cache , retry , pollingInterval
30 | var response2 = response.rebuild((b) => b..listPets[0] = b.listPets[0].rebuild((b) => b..price += 10));
31 | print(response);
32 | print(response2); // now this should be the new value in the cache ?!?!?!?!
33 | yield HomeSuccess();
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/lib/authentication/authentication_credentials.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 |
3 | class AuthenticationCredentials {
4 | final String accessKeyId;
5 | final String secretKey;
6 | final String sessionToken;
7 | final DateTime expiryDateTime;
8 |
9 | AuthenticationCredentials({
10 | this.accessKeyId,
11 | this.expiryDateTime,
12 | this.secretKey,
13 | this.sessionToken,
14 | });
15 |
16 | factory AuthenticationCredentials.fromJson(String json) {
17 | Map data = jsonDecode(json, reviver: (key, value) {
18 | return key == "expiryDateTime" ? DateTime.parse(value) : value;
19 | });
20 | return AuthenticationCredentials(
21 | accessKeyId: data["accessKeyId"],
22 | secretKey: data["secretKey"],
23 | sessionToken: data["sessionToken"],
24 | expiryDateTime: data["expiryDateTime"],
25 | );
26 | }
27 |
28 | String toJson() {
29 | return jsonEncode({
30 | "accessKeyId": accessKeyId,
31 | "secretKey": secretKey,
32 | "sessionToken": sessionToken,
33 | "expiryDateTime": expiryDateTime.toIso8601String()
34 | });
35 | }
36 |
37 | bool get hasExpired => DateTime.now().isAfter(expiryDateTime);
38 | }
39 |
--------------------------------------------------------------------------------
/lib/packages/query_repository.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_aws_app/identity/identity.dart';
2 | import 'package:flutter_aws_app/models/models.dart';
3 | import 'package:flutter_aws_app/packages/query_provider.dart';
4 | import 'package:flutter_aws_app/packages/repository.dart';
5 | import 'package:meta/meta.dart';
6 |
7 | class QueryRepository extends Repository {
8 | final IdentityRepository identityRepository;
9 | final String endpoint;
10 | final String region;
11 | final QueryProvider _queryProvider;
12 |
13 | QueryRepository({
14 | @required this.endpoint,
15 | @required this.region,
16 | @required this.identityRepository,
17 | }) : _queryProvider = QueryProvider(endpoint, region);
18 |
19 | Future query(String fragment, {int retryCount = -1}) async {
20 | Query response;
21 | int retry = 0;
22 | do {
23 | print("try #$retry");
24 | response = await _query(fragment);
25 | } while (response == null && retry++ < retryCount);
26 | return response;
27 | }
28 |
29 | Future _query(String fragment) async {
30 | var credentials = await identityRepository.credentials;
31 | if (credentials == null) {
32 | return null;
33 | }
34 | var response = await _queryProvider.query(
35 | credentials.accessKeyId,
36 | credentials.secretKey,
37 | credentials.sessionToken,
38 | fragment,
39 | );
40 | return response;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/lib/authentication/authentication_bloc.dart:
--------------------------------------------------------------------------------
1 | import 'package:bloc/bloc.dart';
2 | import 'package:flutter_aws_app/authentication/authentication.dart';
3 | import 'package:flutter_aws_app/identity/identity.dart';
4 | import 'package:meta/meta.dart';
5 |
6 | class AuthenticationBloc
7 | extends Bloc {
8 | final IdentityRepository identityRepository;
9 |
10 | AuthenticationBloc({@required this.identityRepository})
11 | : assert(identityRepository != null);
12 |
13 | @override
14 | AuthenticationState get initialState => Uninitialized();
15 |
16 | @override
17 | Stream mapEventToState(
18 | AuthenticationEvent event,
19 | ) async* {
20 | if (event is AppStarted) {
21 | bool isAuthenticated = await identityRepository.isAuthenticated();
22 | if (isAuthenticated) {
23 | yield Authenticated();
24 | } else {
25 | yield Unauthenticated();
26 | }
27 | }
28 | if (event is Authenticate) {
29 | // If this fails (e.g. being offline) the code will be unusable anyways.
30 | // So no need to retry, but rather having to sign in again.
31 | bool isAuthenticated = await identityRepository.authenticate(event.code);
32 | if (isAuthenticated) {
33 | yield Authenticated();
34 | } else {
35 | yield Unauthenticated();
36 | }
37 | }
38 | if (event is SignOut) {
39 | bool isSignedOut = await identityRepository.signOut();
40 | if (isSignedOut) {
41 | yield Unauthenticated();
42 | }
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # Visual Studio Code related
19 | .vscode/
20 |
21 | # Flutter/Dart/Pub related
22 | **/doc/api/
23 | .dart_tool/
24 | .flutter-plugins
25 | .packages
26 | .pub-cache/
27 | .pub/
28 | /build/
29 |
30 | # Android related
31 | **/android/**/gradle-wrapper.jar
32 | **/android/.gradle
33 | **/android/captures/
34 | **/android/gradlew
35 | **/android/gradlew.bat
36 | **/android/local.properties
37 | **/android/**/GeneratedPluginRegistrant.java
38 |
39 | # iOS/XCode related
40 | **/ios/**/*.mode1v3
41 | **/ios/**/*.mode2v3
42 | **/ios/**/*.moved-aside
43 | **/ios/**/*.pbxuser
44 | **/ios/**/*.perspectivev3
45 | **/ios/**/*sync/
46 | **/ios/**/.sconsign.dblite
47 | **/ios/**/.tags*
48 | **/ios/**/.vagrant/
49 | **/ios/**/DerivedData/
50 | **/ios/**/Icon?
51 | **/ios/**/Pods/
52 | **/ios/**/.symlinks/
53 | **/ios/**/profile
54 | **/ios/**/xcuserdata
55 | **/ios/.generated/
56 | **/ios/Flutter/App.framework
57 | **/ios/Flutter/Flutter.framework
58 | **/ios/Flutter/Generated.xcconfig
59 | **/ios/Flutter/app.flx
60 | **/ios/Flutter/app.zip
61 | **/ios/Flutter/flutter_assets/
62 | **/ios/ServiceDefinitions.json
63 | **/ios/Runner/GeneratedPluginRegistrant.*
64 |
65 | # Exceptions to above rules.
66 | !**/ios/**/default.mode1v3
67 | !**/ios/**/default.mode2v3
68 | !**/ios/**/default.pbxuser
69 | !**/ios/**/default.perspectivev3
70 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
71 |
--------------------------------------------------------------------------------
/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | flutter_aws_app
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | $(FLUTTER_BUILD_NAME)
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UISupportedInterfaceOrientations
30 |
31 | UIInterfaceOrientationPortrait
32 | UIInterfaceOrientationLandscapeLeft
33 | UIInterfaceOrientationLandscapeRight
34 |
35 | UISupportedInterfaceOrientations~ipad
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationPortraitUpsideDown
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 | UIViewControllerBasedStatusBarAppearance
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply plugin: 'kotlin-android'
26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27 |
28 | android {
29 | compileSdkVersion 28
30 |
31 | sourceSets {
32 | main.java.srcDirs += 'src/main/kotlin'
33 | }
34 |
35 | lintOptions {
36 | disable 'InvalidPackage'
37 | }
38 |
39 | defaultConfig {
40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
41 | applicationId "com.example.flutter_aws_app"
42 | minSdkVersion 18
43 | targetSdkVersion 28
44 | versionCode flutterVersionCode.toInteger()
45 | versionName flutterVersionName
46 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
47 | }
48 |
49 | buildTypes {
50 | release {
51 | // TODO: Add your own signing config for the release build.
52 | // Signing with the debug keys for now, so `flutter run --release` works.
53 | signingConfig signingConfigs.debug
54 | }
55 | }
56 | }
57 |
58 | flutter {
59 | source '../..'
60 | }
61 |
62 | dependencies {
63 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
64 | testImplementation 'junit:junit:4.12'
65 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
66 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
67 | }
68 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
9 |
15 |
22 |
26 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/lib/packages/repository_provider.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | abstract class Repository {}
4 |
5 | /// A Flutter widget which provides a repository to its children via `RepositoryProvider.of(context)`.
6 | /// It is used as a DI widget so that a single instance of a repository can be provided
7 | /// to multiple widgets within a subtree.
8 | class RepositoryProvider extends InheritedWidget {
9 | /// The [Repository] which is to be made available throughout the subtree
10 | final T repository;
11 |
12 | /// The [Widget] and its descendants which will have access to the [Repository].
13 | final Widget child;
14 |
15 | RepositoryProvider({
16 | Key key,
17 | @required this.repository,
18 | this.child,
19 | }) : assert(repository != null),
20 | super(key: key);
21 |
22 | /// Method that allows widgets to access the repository as long as their `BuildContext`
23 | /// contains a `RepositoryProvider` instance.
24 | static T of(BuildContext context) {
25 | final type = _typeOf>();
26 | final RepositoryProvider provider = context
27 | .ancestorInheritedElementForWidgetOfExactType(type)
28 | ?.widget as RepositoryProvider;
29 |
30 | if (provider == null) {
31 | throw FlutterError(
32 | """
33 | RepositoryProvider.of() called with a context that does not contain a Repository of type $T.
34 | No ancestor could be found starting from the context that was passed to RepositoryProvider.of<$T>().
35 | This can happen if the context you use comes from a widget above the RepositoryProvider.
36 | This can also happen if you used RepositoryProviderTree and didn\'t explicity provide
37 | the RepositoryProvider types: RepositoryProvider(repository: $T()) instead of RepositoryProvider<$T>(repository: $T()).
38 | The context used was: $context
39 | """,
40 | );
41 | }
42 | return provider?.repository;
43 | }
44 |
45 | /// Clone the current [RepositoryProvider] with a new child [Widget].
46 | /// All other values, including [Key] and [Repository] are preserved.
47 | RepositoryProvider copyWith(Widget child) {
48 | return RepositoryProvider(
49 | key: key,
50 | repository: repository,
51 | child: child,
52 | );
53 | }
54 |
55 | /// Necessary to obtain generic [Type]
56 | /// https://github.com/dart-lang/sdk/issues/11923
57 | static Type _typeOf() => T;
58 |
59 | @override
60 | bool updateShouldNotify(RepositoryProvider oldWidget) => false;
61 | }
62 |
--------------------------------------------------------------------------------
/lib/packages/repository_provider_tree.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/widgets.dart';
2 | import 'package:flutter_aws_app/packages/repository.dart';
3 |
4 | /// A Flutter [Widget] that merges multiple [RepositoryProvider] widgets into one widget tree.
5 | ///
6 | /// [RepositoryProviderTree] improves the readability and eliminates the need
7 | /// to nest multiple [RepositoryProviders].
8 | ///
9 | /// By using [RepositoryProviderTree] we can go from:
10 | ///
11 | /// ```dart
12 | /// RepositoryProvider(
13 | /// repository: RepositoryA(),
14 | /// child: RepositoryProvider(
15 | /// repository: RepositoryB(),
16 | /// child: RepositoryProvider(
17 | /// value: RepositoryC(),
18 | /// child: ChildA(),
19 | /// )
20 | /// )
21 | /// )
22 | /// ```
23 | ///
24 | /// to:
25 | ///
26 | /// ```dart
27 | /// RepositoryProviderTree(
28 | /// repositoryProviders: [
29 | /// RepositoryProvider(repository: RepositoryA()),
30 | /// RepositoryProvider(repository: RepositoryB()),
31 | /// RepositoryProvider(repository: RepositoryC()),
32 | /// ],
33 | /// child: ChildA(),
34 | /// )
35 | /// ```
36 | ///
37 | /// [RepositoryProviderTree] converts the [RepositoryProvider] list
38 | /// into a tree of nested [RepositoryProvider] widgets.
39 | /// As a result, the only advantage of using [RepositoryProviderTree] is improved
40 | /// readability due to the reduction in nesting and boilerplate.
41 | class RepositoryProviderTree extends StatelessWidget {
42 | /// The [RepositoryProvider] list which is converted into a tree of [RepositoryProvider] widgets.
43 | /// The tree of [RepositoryProvider] widgets is created in order meaning the first [RepositoryProvider]
44 | /// will be the top-most [RepositoryProvider] and the last [RepositoryProvider] will be a direct ancestor
45 | /// of the `child` [Widget].
46 | final List repositoryProviders;
47 |
48 | /// The [Widget] and its descendants which will have access to every [Repository] provided by `repositoryProviders`.
49 | /// This [Widget] will be a direct descendent of the last [RepositoryProvider] in `repositoryProviders`.
50 | final Widget child;
51 |
52 | RepositoryProviderTree({
53 | Key key,
54 | @required this.repositoryProviders,
55 | @required this.child,
56 | }) : assert(repositoryProviders != null),
57 | assert(child != null),
58 | super(key: key);
59 |
60 | @override
61 | Widget build(BuildContext context) {
62 | Widget tree = child;
63 | for (final repositoryProvider in repositoryProviders.reversed) {
64 | tree = repositoryProvider.copyWith(tree);
65 | }
66 | return tree;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/lib/identity/identity_signout_page.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:flutter_aws_app/authentication/authentication.dart';
5 | import 'package:flutter_aws_app/identity/identity.dart';
6 | import 'package:flutter_aws_app/packages/repository.dart';
7 | import 'package:flutter_bloc/flutter_bloc.dart';
8 | import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';
9 |
10 | // The application's login page.
11 | class IdentitySignOutPage extends StatefulWidget {
12 | @override
13 | _IdentitySignOutPageState createState() => new _IdentitySignOutPageState();
14 | }
15 |
16 | // The application's login page state.
17 | class _IdentitySignOutPageState extends State {
18 | // Identity access.
19 | IdentityRepository _identityRepository;
20 |
21 | // Authentication Bloc.
22 | AuthenticationBloc _authenticationBloc;
23 |
24 | // Webview to present the sign in/up web page.
25 | final flutterWebviewPlugin = new FlutterWebviewPlugin();
26 |
27 | // Webview subscriptions.
28 | StreamSubscription _onDestroy;
29 | StreamSubscription _onUrlChanged;
30 | StreamSubscription _onStateChanged;
31 |
32 | String token;
33 |
34 | @override
35 | void dispose() {
36 | // Every listener should be canceled, the same should be done with this stream.
37 | _onDestroy.cancel();
38 | _onUrlChanged.cancel();
39 | _onStateChanged.cancel();
40 | flutterWebviewPlugin.dispose();
41 | super.dispose();
42 | }
43 |
44 | @override
45 | void initState() {
46 | super.initState();
47 |
48 | _identityRepository = RepositoryProvider.of(context);
49 | _authenticationBloc = BlocProvider.of(context);
50 |
51 | // Close, just to be sure.
52 | flutterWebviewPlugin.close();
53 |
54 | // Add a listener to on destroy WebView, so you can make came actions.
55 | _onDestroy = flutterWebviewPlugin.onDestroy.listen((_) {
56 | print("destroy");
57 | });
58 |
59 | // Add a listener to on state changed.
60 | _onStateChanged =
61 | flutterWebviewPlugin.onStateChanged.listen((WebViewStateChanged state) {
62 | print("onStateChanged: ${state.type} ${state.url}");
63 | });
64 |
65 | // Add a listener to on url changed.
66 | _onUrlChanged = flutterWebviewPlugin.onUrlChanged.listen((String url) {
67 | if (url
68 | .startsWith(_identityRepository.cognitoUserPoolLogoutRedirectUrl)) {
69 | _authenticationBloc.dispatch(SignOut());
70 | Navigator.pop(context);
71 | }
72 | });
73 | }
74 |
75 | @override
76 | Widget build(BuildContext context) {
77 | String logoutUrl = _identityRepository.cognitoUserPoolLogoutUrl;
78 | return new WebviewScaffold(
79 | url: logoutUrl,
80 | hidden: true,
81 | appBar: new AppBar(
82 | title: new Text("Sign Out"),
83 | ),
84 | userAgent:
85 | // TODO change based on platform.
86 | "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1",
87 | );
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/lib/identity/identity_signin_page.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:flutter_aws_app/authentication/authentication.dart';
5 | import 'package:flutter_aws_app/identity/identity.dart';
6 | import 'package:flutter_aws_app/packages/repository.dart';
7 | import 'package:flutter_bloc/flutter_bloc.dart';
8 | import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';
9 |
10 | // The application's login page.
11 | class IdentitySignInPage extends StatefulWidget {
12 | @override
13 | _IdentitySignInPageState createState() => new _IdentitySignInPageState();
14 | }
15 |
16 | // The application's login page state.
17 | class _IdentitySignInPageState extends State {
18 | // Identity access.
19 | IdentityRepository _identityRepository;
20 |
21 | // Authentication Bloc.
22 | AuthenticationBloc _authenticationBloc;
23 |
24 | // Webview to present the sign in/up web page.
25 | final flutterWebviewPlugin = new FlutterWebviewPlugin();
26 |
27 | // Webview subscriptions.
28 | StreamSubscription _onDestroy;
29 | StreamSubscription _onUrlChanged;
30 | StreamSubscription _onStateChanged;
31 |
32 | String token;
33 |
34 | @override
35 | void dispose() {
36 | // Every listener should be canceled, the same should be done with this stream.
37 | _onDestroy.cancel();
38 | _onUrlChanged.cancel();
39 | _onStateChanged.cancel();
40 | flutterWebviewPlugin.dispose();
41 | super.dispose();
42 | }
43 |
44 | @override
45 | void initState() {
46 | super.initState();
47 |
48 | _identityRepository = RepositoryProvider.of(context);
49 | _authenticationBloc = BlocProvider.of(context);
50 |
51 | // Close, just to be sure.
52 | flutterWebviewPlugin.close();
53 |
54 | // Add a listener to on destroy WebView, so you can make came actions.
55 | _onDestroy = flutterWebviewPlugin.onDestroy.listen((_) {
56 | print("destroy");
57 | });
58 |
59 | // Add a listener to on state changed.
60 | _onStateChanged =
61 | flutterWebviewPlugin.onStateChanged.listen((WebViewStateChanged state) {
62 | print("onStateChanged: ${state.type} ${state.url}");
63 | });
64 |
65 | // Add a listener to on url changed.
66 | _onUrlChanged = flutterWebviewPlugin.onUrlChanged.listen((String url) {
67 | if (mounted) {
68 | setState(() {
69 | print("URL changed: $url");
70 | if (url.startsWith(
71 | _identityRepository.cognitoUserPoolLoginRedirectUrl)) {
72 | RegExp regExp = new RegExp("code=(.*)");
73 | token = regExp.firstMatch(url)?.group(1);
74 | print("token $token - $url");
75 | _authenticationBloc.dispatch(Authenticate((b) => b..code = token));
76 | Navigator.pop(context);
77 | }
78 | });
79 | }
80 | });
81 | }
82 |
83 | @override
84 | Widget build(BuildContext context) {
85 | String loginUrl = _identityRepository.cognitoUserPoolLoginUrl;
86 | return new WebviewScaffold(
87 | url: loginUrl,
88 | hidden: true,
89 | appBar: new AppBar(
90 | title: new Text("Sign In"),
91 | ),
92 | userAgent:
93 | // TODO change based on platform.
94 | "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1",
95 | );
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
31 |
32 |
33 |
34 |
40 |
41 |
42 |
43 |
44 |
45 |
56 |
58 |
64 |
65 |
66 |
67 |
68 |
69 |
75 |
77 |
83 |
84 |
85 |
86 |
88 |
89 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/lib/packages/query_provider.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 |
3 | import 'package:flutter_aws_app/models/models.dart';
4 | import 'package:flutter_aws_app/packages/sig_v4.dart';
5 | import 'package:http/http.dart' as http;
6 |
7 | class QueryProvider {
8 | final String endpoint;
9 | final String region;
10 |
11 | QueryProvider(this.endpoint, this.region);
12 |
13 | Future post(
14 | String accessKey,
15 | String secretKey,
16 | String sessionToken,
17 | String operationName,
18 | String query,
19 | ) async {
20 | final sigV4Client = new AwsSigV4Client(
21 | accessKey,
22 | secretKey,
23 | endpoint,
24 | serviceName: 'appsync',
25 | sessionToken: sessionToken,
26 | region: region,
27 | );
28 |
29 | final sigV4Request = new SigV4Request(
30 | sigV4Client,
31 | method: "POST",
32 | path: "/graphql",
33 | headers: new Map.from({
34 | "Content-Type": "application/graphql; charset=utf-8",
35 | }),
36 | body: new Map.from({
37 | "operationName": operationName,
38 | "query": query,
39 | }),
40 | );
41 |
42 | http.Response response;
43 | try {
44 | response = await http.post(
45 | sigV4Request.url,
46 | headers: sigV4Request.headers,
47 | body: sigV4Request.body,
48 | );
49 | } catch (e) {
50 | print(e);
51 | return null;
52 | }
53 | var data;
54 | try {
55 | data = json.decode(response.body);
56 | } catch (e) {
57 | print(e);
58 | return null;
59 | }
60 | if (response.statusCode < 200 || response.statusCode > 299) {
61 | String errorType = "UnknownError";
62 | for (String header in response.headers.keys) {
63 | if (header.toLowerCase() == "x-amzn-errortype") {
64 | errorType = response.headers[header].split(':')[0];
65 | break;
66 | }
67 | }
68 | if (data == null) {
69 | print("$errorType, statusCode: ${response.statusCode}");
70 | }
71 | return null;
72 | }
73 | // TODO errors are per field, so is this to restrictive?
74 | if (data["errors"] != null) {
75 | print(data["errors"]);
76 | return null;
77 | }
78 | return data;
79 | }
80 |
81 | Future query(
82 | String accessKey,
83 | String secretKey,
84 | String sessionToken,
85 | String fragment,
86 | ) async {
87 | var data = await post(
88 | accessKey,
89 | secretKey,
90 | sessionToken,
91 | "operation",
92 | "query operation { $fragment }",
93 | );
94 | Query query;
95 | try {
96 | query = data == null
97 | ? null
98 | : standardSerializers.deserializeWith(Query.serializer, data["data"]);
99 | } catch (e) {
100 | print(e);
101 | return null;
102 | }
103 | return query;
104 | }
105 | }
106 |
107 | //var x = standardSerializers.deserializeWith(PetList.serializer, data["data"]);
108 | //final specifiedType = FullType(BuiltList, const [const FullType(Pet)]);
109 | //var x = standardSerializers.deserialize(data["data"]["listPets"], specifiedType: specifiedType);
110 |
111 | //var timeout = {
112 | // "data": {"listPets": null},
113 | // "errors": [
114 | // {
115 | // "path": ["listPets"],
116 | // "data": null,
117 | // "errorType": "ExecutionTimeout",
118 | // "errorInfo": null,
119 | // "locations": [
120 | // {"line": 2, "column": 9, "sourceName": null}
121 | // ],
122 | // "message": "Execution timed out."
123 | // }
124 | // ]
125 | //};
126 |
127 | // {"data":{"listPets":null},"errors":[{"path":["listPets"],"data":null,"errorType":"ExecutionTimeout","errorInfo":null,"locations":[{"line":2,"column":9,"sourceName":null}],"message":"Execution timed out."}]}
128 |
129 | // {"data":{"listPets":[{"id":"e26b33ed-c2b4-45e0-a344-aa8775a57861","price":11.0,"type":"fish"}]}}
130 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: flutter_aws_app
2 | description: A new Flutter application.
3 |
4 | # The following defines the version and build number for your application.
5 | # A version number is three numbers separated by dots, like 1.2.43
6 | # followed by an optional build number separated by a +.
7 | # Both the version and the builder number may be overridden in flutter
8 | # build by specifying --build-name and --build-number, respectively.
9 | # In Android, build-name is used as versionName while build-number used as versionCode.
10 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning
11 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
12 | # Read more about iOS versioning at
13 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
14 | version: 1.0.0+1
15 |
16 | environment:
17 | sdk: ">=2.1.0 <3.0.0"
18 |
19 | dependencies:
20 | flutter:
21 | sdk: flutter
22 |
23 | # The following adds the Cupertino Icons font to your application.
24 | # Use with the CupertinoIcons class for iOS style icons.
25 | cupertino_icons: ^0.1.2
26 |
27 | # The following adds the bloc pattern to your application.
28 | # All details can be found here https://felangel.github.io/bloc/
29 | bloc: ^0.13.0
30 | flutter_bloc: ^0.13.0
31 |
32 | # The following adds a Webview tho your application.
33 | # It is used to sign in/up users to Cognito User Pools using the Hosted Web UI.
34 | # This should become obsolete once proper Cognito support arrives for flutter.
35 | flutter_webview_plugin: ^0.3.4
36 |
37 | # The following adds Deep Linking to your application.
38 | uni_links: ^0.2.0
39 |
40 | # The following adds HTTP REST API access capabilities to your application.
41 | http: any
42 |
43 | # Cryptography for SigV4 signing.
44 | crypto: any
45 |
46 | # The following adds secure key storage to your application.
47 | flutter_secure_storage: ^3.2.1+1
48 |
49 | # The following adds a heads up display component to your application.
50 | modal_progress_hud: ^0.1.3
51 |
52 | # The following adds immutable value builders to your application.
53 | built_value: ^6.5.0
54 | built_collection: ^4.2.2
55 |
56 | dev_dependencies:
57 | # The following adds immutable value builders to your application.
58 | # Run 'flutter packages pub run build_runner build' to build.
59 | build_runner:
60 | built_value_generator: ^6.5.0
61 |
62 | # The following is testing related.
63 | flutter_test:
64 | sdk: flutter
65 |
66 |
67 | # For information on the generic Dart part of this file, see the
68 | # following page: https://www.dartlang.org/tools/pub/pubspec
69 |
70 | # The following section is specific to Flutter.
71 | flutter:
72 |
73 | # The following line ensures that the Material Icons font is
74 | # included with your application, so that you can use the icons in
75 | # the material Icons class.
76 | uses-material-design: true
77 |
78 | # To add assets to your application, add an assets section, like this:
79 | # assets:
80 | # - images/a_dot_burr.jpeg
81 | # - images/a_dot_ham.jpeg
82 |
83 | # An image asset can refer to one or more resolution-specific "variants", see
84 | # https://flutter.io/assets-and-images/#resolution-aware.
85 |
86 | # For details regarding adding assets from package dependencies, see
87 | # https://flutter.io/assets-and-images/#from-packages
88 |
89 | # To add custom fonts to your application, add a fonts section here,
90 | # in this "flutter" section. Each entry in this list should have a
91 | # "family" key with the font family name, and a "fonts" key with a
92 | # list giving the asset and other descriptors for the font. For
93 | # example:
94 | # fonts:
95 | # - family: Schyler
96 | # fonts:
97 | # - asset: fonts/Schyler-Regular.ttf
98 | # - asset: fonts/Schyler-Italic.ttf
99 | # style: italic
100 | # - family: Trajan Pro
101 | # fonts:
102 | # - asset: fonts/TrajanPro.ttf
103 | # - asset: fonts/TrajanPro_Bold.ttf
104 | # weight: 700
105 | #
106 | # For details regarding fonts from package dependencies,
107 | # see https://flutter.io/custom-fonts/#from-packages
108 |
--------------------------------------------------------------------------------
/lib/home/home_events.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'home_events.dart';
4 |
5 | // **************************************************************************
6 | // BuiltValueGenerator
7 | // **************************************************************************
8 |
9 | class _$Fetch extends Fetch {
10 | @override
11 | final String operationName;
12 | @override
13 | final String query;
14 |
15 | factory _$Fetch([void Function(FetchBuilder) updates]) =>
16 | (new FetchBuilder()..update(updates)).build();
17 |
18 | _$Fetch._({this.operationName, this.query}) : super._() {
19 | if (operationName == null) {
20 | throw new BuiltValueNullFieldError('Fetch', 'operationName');
21 | }
22 | if (query == null) {
23 | throw new BuiltValueNullFieldError('Fetch', 'query');
24 | }
25 | }
26 |
27 | @override
28 | Fetch rebuild(void Function(FetchBuilder) updates) =>
29 | (toBuilder()..update(updates)).build();
30 |
31 | @override
32 | FetchBuilder toBuilder() => new FetchBuilder()..replace(this);
33 |
34 | @override
35 | bool operator ==(Object other) {
36 | if (identical(other, this)) return true;
37 | return other is Fetch &&
38 | operationName == other.operationName &&
39 | query == other.query;
40 | }
41 |
42 | @override
43 | int get hashCode {
44 | return $jf($jc($jc(0, operationName.hashCode), query.hashCode));
45 | }
46 |
47 | @override
48 | String toString() {
49 | return (newBuiltValueToStringHelper('Fetch')
50 | ..add('operationName', operationName)
51 | ..add('query', query))
52 | .toString();
53 | }
54 | }
55 |
56 | class FetchBuilder implements Builder {
57 | _$Fetch _$v;
58 |
59 | String _operationName;
60 | String get operationName => _$this._operationName;
61 | set operationName(String operationName) =>
62 | _$this._operationName = operationName;
63 |
64 | String _query;
65 | String get query => _$this._query;
66 | set query(String query) => _$this._query = query;
67 |
68 | FetchBuilder();
69 |
70 | FetchBuilder get _$this {
71 | if (_$v != null) {
72 | _operationName = _$v.operationName;
73 | _query = _$v.query;
74 | _$v = null;
75 | }
76 | return this;
77 | }
78 |
79 | @override
80 | void replace(Fetch other) {
81 | if (other == null) {
82 | throw new ArgumentError.notNull('other');
83 | }
84 | _$v = other as _$Fetch;
85 | }
86 |
87 | @override
88 | void update(void Function(FetchBuilder) updates) {
89 | if (updates != null) updates(this);
90 | }
91 |
92 | @override
93 | _$Fetch build() {
94 | final _$result =
95 | _$v ?? new _$Fetch._(operationName: operationName, query: query);
96 | replace(_$result);
97 | return _$result;
98 | }
99 | }
100 |
101 | class _$Initialize extends Initialize {
102 | factory _$Initialize([void Function(InitializeBuilder) updates]) =>
103 | (new InitializeBuilder()..update(updates)).build();
104 |
105 | _$Initialize._() : super._();
106 |
107 | @override
108 | Initialize rebuild(void Function(InitializeBuilder) updates) =>
109 | (toBuilder()..update(updates)).build();
110 |
111 | @override
112 | InitializeBuilder toBuilder() => new InitializeBuilder()..replace(this);
113 |
114 | @override
115 | bool operator ==(Object other) {
116 | if (identical(other, this)) return true;
117 | return other is Initialize;
118 | }
119 |
120 | @override
121 | int get hashCode {
122 | return 33416838;
123 | }
124 |
125 | @override
126 | String toString() {
127 | return newBuiltValueToStringHelper('Initialize').toString();
128 | }
129 | }
130 |
131 | class InitializeBuilder implements Builder {
132 | _$Initialize _$v;
133 |
134 | InitializeBuilder();
135 |
136 | @override
137 | void replace(Initialize other) {
138 | if (other == null) {
139 | throw new ArgumentError.notNull('other');
140 | }
141 | _$v = other as _$Initialize;
142 | }
143 |
144 | @override
145 | void update(void Function(InitializeBuilder) updates) {
146 | if (updates != null) updates(this);
147 | }
148 |
149 | @override
150 | _$Initialize build() {
151 | final _$result = _$v ?? new _$Initialize._();
152 | replace(_$result);
153 | return _$result;
154 | }
155 | }
156 |
157 | // ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,lines_longer_than_80_chars,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new
158 |
--------------------------------------------------------------------------------
/lib/models/pet.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'pet.dart';
4 |
5 | // **************************************************************************
6 | // BuiltValueGenerator
7 | // **************************************************************************
8 |
9 | Serializer _$petSerializer = new _$PetSerializer();
10 |
11 | class _$PetSerializer implements StructuredSerializer {
12 | @override
13 | final Iterable types = const [Pet, _$Pet];
14 | @override
15 | final String wireName = 'Pet';
16 |
17 | @override
18 | Iterable serialize(Serializers serializers, Pet object,
19 | {FullType specifiedType = FullType.unspecified}) {
20 | final result =