├── .gitignore ├── .metadata ├── LICENSE ├── README.md ├── analysis_options.yaml ├── android ├── .gitignore ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── flutter_provider_examples │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── 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 │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── doc └── images │ ├── screencast1.gif │ ├── screencast2.gif │ ├── screencast3.gif │ └── screencast4.gif ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ └── contents.xcworkspacedata └── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-App-1024x1024@1x.png │ │ ├── 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-83.5x83.5@2x.png │ └── LaunchImage.imageset │ │ ├── Contents.json │ │ ├── LaunchImage.png │ │ ├── LaunchImage@2x.png │ │ ├── LaunchImage@3x.png │ │ └── README.md │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── Runner-Bridging-Header.h ├── lib ├── blocs │ └── counter_bloc.dart ├── main.dart ├── models │ ├── change_notifier_counter.dart │ ├── dependency_injection_counter.dart │ ├── hex_counter.dart │ ├── reassembling_counter.dart │ └── value_notifier_counter.dart └── pages │ ├── change_notifier_provider.dart │ ├── change_notifier_provider_value.dart │ ├── dependency_injection.dart │ ├── future_provider.dart │ ├── list.dart │ ├── listenable_provider.dart │ ├── provider.dart │ ├── provider_value.dart │ ├── proxy_provider.dart │ ├── proxy_provider0.dart │ ├── reassemble_handler.dart │ ├── selector.dart │ ├── stream_provider.dart │ ├── stream_provider_value.dart │ ├── value_listenable_provider.dart │ └── value_listenable_provider_value.dart ├── pubspec.lock └── pubspec.yaml /.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 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | /build/ 32 | 33 | # Web related 34 | lib/generated_plugin_registrant.dart 35 | 36 | # Exceptions to above rules. 37 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 38 | -------------------------------------------------------------------------------- /.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: 7a4c33425ddd78c54aba07d86f3f9a4a0051769b 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019 kaboc 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Examples of Flutter's provider package 2 | 3 | This repository shows how to use the provider package. 4 | 5 | ![Screencast1](doc/images/screencast1.gif) 6 | ![Screencast2](doc/images/screencast2.gif) 7 | ![Screencast3](doc/images/screencast3.gif) 8 | ![Screencast4](doc/images/screencast4.gif) 9 | 10 | Each example is described in my articles below: 11 | 12 | * [[Flutter] package:provider の各プロバイダの詳細 - Qiita](https://qiita.com/kabochapo/items/a90d8438243c27e2f6d9) 13 | * [【Flutter】依存オブジェクトの注入 - のんびり精進](https://kabochapo.hateblo.jp/entry/2019/07/01/211953) 14 | 15 | See also the official documentation for more detailed information: 16 | 17 | * [provider | Flutter Package](https://pub.dev/packages/provider) 18 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # Specify analysis options. 2 | # 3 | # Until there are meta linter rules, each desired lint must be explicitly enabled. 4 | # See: https://github.com/dart-lang/linter/issues/288 5 | # 6 | # For a list of lints, see: http://dart-lang.github.io/linter/lints/ 7 | # See the configuration guide for more 8 | # https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer 9 | # 10 | # There are other similar analysis options files in the flutter repos, 11 | # which should be kept in sync with this file: 12 | # 13 | # - analysis_options.yaml (this file) 14 | # - packages/flutter/lib/analysis_options_user.yaml 15 | # - https://github.com/flutter/plugins/blob/master/analysis_options.yaml 16 | # - https://github.com/flutter/engine/blob/master/analysis_options.yaml 17 | # 18 | # This file contains the analysis options used by Flutter tools, such as IntelliJ, 19 | # Android Studio, and the `flutter analyze` command. 20 | 21 | analyzer: 22 | strong-mode: 23 | implicit-casts: false 24 | implicit-dynamic: false 25 | errors: 26 | # treat missing required parameters as a warning (not a hint) 27 | missing_required_param: warning 28 | # treat missing returns as a warning (not a hint) 29 | missing_return: warning 30 | # allow having TODOs in the code 31 | todo: ignore 32 | # Ignore analyzer hints for updating pubspecs when using Future or 33 | # Stream and not importing dart:async 34 | # Please see https://github.com/flutter/flutter/pull/24528 for details. 35 | sdk_version_async_exported_from_core: ignore 36 | exclude: 37 | - "bin/cache/**" 38 | # the following two are relative to the stocks example and the flutter package respectively 39 | # see https://github.com/dart-lang/sdk/issues/28463 40 | - "lib/i18n/messages_*.dart" 41 | - "lib/src/http/**" 42 | 43 | linter: 44 | rules: 45 | # these rules are documented on and in the same order as 46 | # the Dart Lint rules page to make maintenance easier 47 | # https://github.com/dart-lang/linter/blob/master/example/all.yaml 48 | - always_declare_return_types 49 | - always_put_control_body_on_new_line 50 | # - always_put_required_named_parameters_first # we prefer having parameters in the same order as fields https://github.com/flutter/flutter/issues/10219 51 | - always_require_non_null_named_parameters 52 | # - always_specify_types 53 | - annotate_overrides 54 | # - avoid_annotating_with_dynamic # conflicts with always_specify_types 55 | # - avoid_as # required for implicit-casts: true 56 | - avoid_bool_literals_in_conditional_expressions 57 | # - avoid_catches_without_on_clauses # we do this commonly 58 | # - avoid_catching_errors # we do this commonly 59 | - avoid_classes_with_only_static_members 60 | # - avoid_double_and_int_checks # only useful when targeting JS runtime 61 | - avoid_empty_else 62 | - avoid_equals_and_hash_code_on_mutable_classes 63 | - avoid_field_initializers_in_const_classes 64 | - avoid_function_literals_in_foreach_calls 65 | # - avoid_implementing_value_types # not yet tested 66 | - avoid_init_to_null 67 | # - avoid_js_rounded_ints # only useful when targeting JS runtime 68 | - avoid_null_checks_in_equality_operators 69 | # - avoid_positional_boolean_parameters # not yet tested 70 | # - avoid_print # not yet tested 71 | # - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356) 72 | # - avoid_redundant_argument_values # not yet tested 73 | - avoid_relative_lib_imports 74 | - avoid_renaming_method_parameters 75 | - avoid_return_types_on_setters 76 | # - avoid_returning_null # there are plenty of valid reasons to return null 77 | # - avoid_returning_null_for_future # not yet tested 78 | - avoid_returning_null_for_void 79 | # - avoid_returning_this # there are plenty of valid reasons to return this 80 | # - avoid_setters_without_getters # not yet tested 81 | # - avoid_shadowing_type_parameters # not yet tested 82 | - avoid_single_cascade_in_expression_statements 83 | - avoid_slow_async_io 84 | - avoid_types_as_parameter_names 85 | # - avoid_types_on_closure_parameters # conflicts with always_specify_types 86 | # - avoid_unnecessary_containers # not yet tested 87 | - avoid_unused_constructor_parameters 88 | - avoid_void_async 89 | # - avoid_web_libraries_in_flutter # not yet tested 90 | - await_only_futures 91 | - camel_case_extensions 92 | - camel_case_types 93 | - cancel_subscriptions 94 | # - cascade_invocations # not yet tested 95 | # - close_sinks # not reliable enough 96 | # - comment_references # blocked on https://github.com/flutter/flutter/issues/20765 97 | # - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204 98 | - control_flow_in_finally 99 | # - curly_braces_in_flow_control_structures # not yet tested 100 | # - diagnostic_describe_all_properties # not yet tested 101 | - directives_ordering 102 | - empty_catches 103 | - empty_constructor_bodies 104 | - empty_statements 105 | # - file_names # not yet tested 106 | - flutter_style_todos 107 | - hash_and_equals 108 | - implementation_imports 109 | # - invariant_booleans # too many false positives: https://github.com/dart-lang/linter/issues/811 110 | - iterable_contains_unrelated_type 111 | # - join_return_with_assignment # not yet tested 112 | - library_names 113 | - library_prefixes 114 | # - lines_longer_than_80_chars # not yet tested 115 | - list_remove_unrelated_type 116 | # - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/sdk/issues/34181 117 | # - missing_whitespace_between_adjacent_strings # not yet tested 118 | - no_adjacent_strings_in_list 119 | - no_duplicate_case_values 120 | # - no_logic_in_create_state # not yet tested 121 | # - no_runtimeType_toString # not yet tested 122 | - non_constant_identifier_names 123 | # - null_closures # not yet tested 124 | # - omit_local_variable_types # opposite of always_specify_types 125 | # - one_member_abstracts # too many false positives 126 | # - only_throw_errors # https://github.com/flutter/flutter/issues/5792 127 | - overridden_fields 128 | - package_api_docs 129 | - package_names 130 | - package_prefixed_library_names 131 | # - parameter_assignments # we do this commonly 132 | - prefer_adjacent_string_concatenation 133 | - prefer_asserts_in_initializer_lists 134 | # - prefer_asserts_with_message # not yet tested 135 | - prefer_collection_literals 136 | - prefer_conditional_assignment 137 | - prefer_const_constructors 138 | - prefer_const_constructors_in_immutables 139 | - prefer_const_declarations 140 | - prefer_const_literals_to_create_immutables 141 | # - prefer_constructors_over_static_methods # not yet tested 142 | - prefer_contains 143 | # - prefer_double_quotes # opposite of prefer_single_quotes 144 | - prefer_equal_for_default_values 145 | # - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods 146 | - prefer_final_fields 147 | - prefer_final_in_for_each 148 | - prefer_final_locals 149 | - prefer_for_elements_to_map_fromIterable 150 | - prefer_foreach 151 | # - prefer_function_declarations_over_variables # not yet tested 152 | - prefer_generic_function_type_aliases 153 | - prefer_if_elements_to_conditional_expressions 154 | - prefer_if_null_operators 155 | - prefer_initializing_formals 156 | - prefer_inlined_adds 157 | # - prefer_int_literals # not yet tested 158 | # - prefer_interpolation_to_compose_strings # not yet tested 159 | - prefer_is_empty 160 | - prefer_is_not_empty 161 | - prefer_is_not_operator 162 | - prefer_iterable_whereType 163 | # - prefer_mixin # https://github.com/dart-lang/language/issues/32 164 | # - prefer_null_aware_operators # disable until NNBD, see https://github.com/flutter/flutter/pull/32711#issuecomment-492930932 165 | # - prefer_relative_imports # not yet tested 166 | - prefer_single_quotes 167 | - prefer_spread_collections 168 | - prefer_typing_uninitialized_variables 169 | - prefer_void_to_null 170 | # - provide_deprecation_message # not yet tested 171 | # - public_member_api_docs # enabled on a case-by-case basis; see e.g. packages/analysis_options.yaml 172 | - recursive_getters 173 | - slash_for_doc_comments 174 | # - sort_child_properties_last # not yet tested 175 | - sort_constructors_first 176 | - sort_pub_dependencies 177 | - sort_unnamed_constructors_first 178 | - test_types_in_equals 179 | - throw_in_finally 180 | # - type_annotate_public_apis # subset of always_specify_types 181 | - type_init_formals 182 | # - unawaited_futures # too many false positives 183 | # - unnecessary_await_in_return # not yet tested 184 | - unnecessary_brace_in_string_interps 185 | - unnecessary_const 186 | # - unnecessary_final # conflicts with prefer_final_locals 187 | - unnecessary_getters_setters 188 | # - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498 189 | - unnecessary_new 190 | - unnecessary_null_aware_assignments 191 | - unnecessary_null_in_if_null_operators 192 | - unnecessary_overrides 193 | - unnecessary_parenthesis 194 | - unnecessary_statements 195 | - unnecessary_string_interpolations 196 | - unnecessary_this 197 | - unrelated_type_equality_checks 198 | # - unsafe_html # not yet tested 199 | - use_full_hex_values_for_flutter_colors 200 | # - use_function_type_syntax_for_parameters # not yet tested 201 | # - use_key_in_widget_constructors # not yet tested 202 | - use_rethrow_when_possible 203 | # - use_setters_to_change_properties # not yet tested 204 | # - use_string_buffers # has false positives: https://github.com/dart-lang/sdk/issues/34182 205 | # - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review 206 | - valid_regexps 207 | - void_checks 208 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | -------------------------------------------------------------------------------- /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_provider_examples" 42 | minSdkVersion 16 43 | targetSdkVersion 28 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | testInstrumentationRunner "androidx.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 'androidx.test:runner:1.1.1' 66 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 67 | } 68 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 12 | 19 | 20 | 21 | 22 | 23 | 24 | 26 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/flutter_provider_examples/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.flutter_provider_examples 2 | 3 | import androidx.annotation.NonNull; 4 | import io.flutter.embedding.android.FlutterActivity 5 | import io.flutter.embedding.engine.FlutterEngine 6 | import io.flutter.plugins.GeneratedPluginRegistrant 7 | 8 | class MainActivity: FlutterActivity() { 9 | override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { 10 | GeneratedPluginRegistrant.registerWith(flutterEngine); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaboc/flutter_provider_examples/38017e4f0022c6d85e3b9df8e05cbb04bed8d403/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaboc/flutter_provider_examples/38017e4f0022c6d85e3b9df8e05cbb04bed8d403/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaboc/flutter_provider_examples/38017e4f0022c6d85e3b9df8e05cbb04bed8d403/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaboc/flutter_provider_examples/38017e4f0022c6d85e3b9df8e05cbb04bed8d403/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaboc/flutter_provider_examples/38017e4f0022c6d85e3b9df8e05cbb04bed8d403/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.50' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.5.0' 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 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /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-5.6.2-all.zip 7 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /doc/images/screencast1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaboc/flutter_provider_examples/38017e4f0022c6d85e3b9df8e05cbb04bed8d403/doc/images/screencast1.gif -------------------------------------------------------------------------------- /doc/images/screencast2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaboc/flutter_provider_examples/38017e4f0022c6d85e3b9df8e05cbb04bed8d403/doc/images/screencast2.gif -------------------------------------------------------------------------------- /doc/images/screencast3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaboc/flutter_provider_examples/38017e4f0022c6d85e3b9df8e05cbb04bed8d403/doc/images/screencast3.gif -------------------------------------------------------------------------------- /doc/images/screencast4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaboc/flutter_provider_examples/38017e4f0022c6d85e3b9df8e05cbb04bed8d403/doc/images/screencast4.gif -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 13 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 14 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 15 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 16 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 17 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 18 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 19 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXCopyFilesBuildPhase section */ 23 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 24 | isa = PBXCopyFilesBuildPhase; 25 | buildActionMask = 2147483647; 26 | dstPath = ""; 27 | dstSubfolderSpec = 10; 28 | files = ( 29 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 30 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 31 | ); 32 | name = "Embed Frameworks"; 33 | runOnlyForDeploymentPostprocessing = 0; 34 | }; 35 | /* End PBXCopyFilesBuildPhase section */ 36 | 37 | /* Begin PBXFileReference section */ 38 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 39 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 40 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 41 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 42 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 43 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 44 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 45 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 46 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 47 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 48 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 50 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 51 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 52 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 53 | /* End PBXFileReference section */ 54 | 55 | /* Begin PBXFrameworksBuildPhase section */ 56 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 57 | isa = PBXFrameworksBuildPhase; 58 | buildActionMask = 2147483647; 59 | files = ( 60 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 61 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 62 | ); 63 | runOnlyForDeploymentPostprocessing = 0; 64 | }; 65 | /* End PBXFrameworksBuildPhase section */ 66 | 67 | /* Begin PBXGroup section */ 68 | 9740EEB11CF90186004384FC /* Flutter */ = { 69 | isa = PBXGroup; 70 | children = ( 71 | 3B80C3931E831B6300D905FE /* App.framework */, 72 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 73 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 74 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 75 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 76 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 77 | ); 78 | name = Flutter; 79 | sourceTree = ""; 80 | }; 81 | 97C146E51CF9000F007C117D = { 82 | isa = PBXGroup; 83 | children = ( 84 | 9740EEB11CF90186004384FC /* Flutter */, 85 | 97C146F01CF9000F007C117D /* Runner */, 86 | 97C146EF1CF9000F007C117D /* Products */, 87 | ); 88 | sourceTree = ""; 89 | }; 90 | 97C146EF1CF9000F007C117D /* Products */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | 97C146EE1CF9000F007C117D /* Runner.app */, 94 | ); 95 | name = Products; 96 | sourceTree = ""; 97 | }; 98 | 97C146F01CF9000F007C117D /* Runner */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 102 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 103 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 104 | 97C147021CF9000F007C117D /* Info.plist */, 105 | 97C146F11CF9000F007C117D /* Supporting Files */, 106 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 107 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 108 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 109 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 110 | ); 111 | path = Runner; 112 | sourceTree = ""; 113 | }; 114 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | ); 118 | name = "Supporting Files"; 119 | sourceTree = ""; 120 | }; 121 | /* End PBXGroup section */ 122 | 123 | /* Begin PBXNativeTarget section */ 124 | 97C146ED1CF9000F007C117D /* Runner */ = { 125 | isa = PBXNativeTarget; 126 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 127 | buildPhases = ( 128 | 9740EEB61CF901F6004384FC /* Run Script */, 129 | 97C146EA1CF9000F007C117D /* Sources */, 130 | 97C146EB1CF9000F007C117D /* Frameworks */, 131 | 97C146EC1CF9000F007C117D /* Resources */, 132 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 133 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 134 | ); 135 | buildRules = ( 136 | ); 137 | dependencies = ( 138 | ); 139 | name = Runner; 140 | productName = Runner; 141 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 142 | productType = "com.apple.product-type.application"; 143 | }; 144 | /* End PBXNativeTarget section */ 145 | 146 | /* Begin PBXProject section */ 147 | 97C146E61CF9000F007C117D /* Project object */ = { 148 | isa = PBXProject; 149 | attributes = { 150 | LastUpgradeCheck = 1020; 151 | ORGANIZATIONNAME = "The Chromium Authors"; 152 | TargetAttributes = { 153 | 97C146ED1CF9000F007C117D = { 154 | CreatedOnToolsVersion = 7.3.1; 155 | LastSwiftMigration = 1100; 156 | }; 157 | }; 158 | }; 159 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 160 | compatibilityVersion = "Xcode 3.2"; 161 | developmentRegion = en; 162 | hasScannedForEncodings = 0; 163 | knownRegions = ( 164 | en, 165 | Base, 166 | ); 167 | mainGroup = 97C146E51CF9000F007C117D; 168 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 169 | projectDirPath = ""; 170 | projectRoot = ""; 171 | targets = ( 172 | 97C146ED1CF9000F007C117D /* Runner */, 173 | ); 174 | }; 175 | /* End PBXProject section */ 176 | 177 | /* Begin PBXResourcesBuildPhase section */ 178 | 97C146EC1CF9000F007C117D /* Resources */ = { 179 | isa = PBXResourcesBuildPhase; 180 | buildActionMask = 2147483647; 181 | files = ( 182 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 183 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 184 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 185 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 186 | ); 187 | runOnlyForDeploymentPostprocessing = 0; 188 | }; 189 | /* End PBXResourcesBuildPhase section */ 190 | 191 | /* Begin PBXShellScriptBuildPhase section */ 192 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 193 | isa = PBXShellScriptBuildPhase; 194 | buildActionMask = 2147483647; 195 | files = ( 196 | ); 197 | inputPaths = ( 198 | ); 199 | name = "Thin Binary"; 200 | outputPaths = ( 201 | ); 202 | runOnlyForDeploymentPostprocessing = 0; 203 | shellPath = /bin/sh; 204 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 205 | }; 206 | 9740EEB61CF901F6004384FC /* Run Script */ = { 207 | isa = PBXShellScriptBuildPhase; 208 | buildActionMask = 2147483647; 209 | files = ( 210 | ); 211 | inputPaths = ( 212 | ); 213 | name = "Run Script"; 214 | outputPaths = ( 215 | ); 216 | runOnlyForDeploymentPostprocessing = 0; 217 | shellPath = /bin/sh; 218 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 219 | }; 220 | /* End PBXShellScriptBuildPhase section */ 221 | 222 | /* Begin PBXSourcesBuildPhase section */ 223 | 97C146EA1CF9000F007C117D /* Sources */ = { 224 | isa = PBXSourcesBuildPhase; 225 | buildActionMask = 2147483647; 226 | files = ( 227 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 228 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 229 | ); 230 | runOnlyForDeploymentPostprocessing = 0; 231 | }; 232 | /* End PBXSourcesBuildPhase section */ 233 | 234 | /* Begin PBXVariantGroup section */ 235 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 236 | isa = PBXVariantGroup; 237 | children = ( 238 | 97C146FB1CF9000F007C117D /* Base */, 239 | ); 240 | name = Main.storyboard; 241 | sourceTree = ""; 242 | }; 243 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 244 | isa = PBXVariantGroup; 245 | children = ( 246 | 97C147001CF9000F007C117D /* Base */, 247 | ); 248 | name = LaunchScreen.storyboard; 249 | sourceTree = ""; 250 | }; 251 | /* End PBXVariantGroup section */ 252 | 253 | /* Begin XCBuildConfiguration section */ 254 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 255 | isa = XCBuildConfiguration; 256 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 257 | buildSettings = { 258 | ALWAYS_SEARCH_USER_PATHS = NO; 259 | CLANG_ANALYZER_NONNULL = YES; 260 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 261 | CLANG_CXX_LIBRARY = "libc++"; 262 | CLANG_ENABLE_MODULES = YES; 263 | CLANG_ENABLE_OBJC_ARC = YES; 264 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 265 | CLANG_WARN_BOOL_CONVERSION = YES; 266 | CLANG_WARN_COMMA = YES; 267 | CLANG_WARN_CONSTANT_CONVERSION = YES; 268 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 269 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 270 | CLANG_WARN_EMPTY_BODY = YES; 271 | CLANG_WARN_ENUM_CONVERSION = YES; 272 | CLANG_WARN_INFINITE_RECURSION = YES; 273 | CLANG_WARN_INT_CONVERSION = YES; 274 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 275 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 276 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 277 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 278 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 279 | CLANG_WARN_STRICT_PROTOTYPES = YES; 280 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 281 | CLANG_WARN_UNREACHABLE_CODE = YES; 282 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 283 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 284 | COPY_PHASE_STRIP = NO; 285 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 286 | ENABLE_NS_ASSERTIONS = NO; 287 | ENABLE_STRICT_OBJC_MSGSEND = YES; 288 | GCC_C_LANGUAGE_STANDARD = gnu99; 289 | GCC_NO_COMMON_BLOCKS = YES; 290 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 291 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 292 | GCC_WARN_UNDECLARED_SELECTOR = YES; 293 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 294 | GCC_WARN_UNUSED_FUNCTION = YES; 295 | GCC_WARN_UNUSED_VARIABLE = YES; 296 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 297 | MTL_ENABLE_DEBUG_INFO = NO; 298 | SDKROOT = iphoneos; 299 | SUPPORTED_PLATFORMS = iphoneos; 300 | TARGETED_DEVICE_FAMILY = "1,2"; 301 | VALIDATE_PRODUCT = YES; 302 | }; 303 | name = Profile; 304 | }; 305 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 306 | isa = XCBuildConfiguration; 307 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 308 | buildSettings = { 309 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 310 | CLANG_ENABLE_MODULES = YES; 311 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 312 | ENABLE_BITCODE = NO; 313 | FRAMEWORK_SEARCH_PATHS = ( 314 | "$(inherited)", 315 | "$(PROJECT_DIR)/Flutter", 316 | ); 317 | INFOPLIST_FILE = Runner/Info.plist; 318 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 319 | LIBRARY_SEARCH_PATHS = ( 320 | "$(inherited)", 321 | "$(PROJECT_DIR)/Flutter", 322 | ); 323 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterProviderExamples; 324 | PRODUCT_NAME = "$(TARGET_NAME)"; 325 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 326 | SWIFT_VERSION = 5.0; 327 | VERSIONING_SYSTEM = "apple-generic"; 328 | }; 329 | name = Profile; 330 | }; 331 | 97C147031CF9000F007C117D /* Debug */ = { 332 | isa = XCBuildConfiguration; 333 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 334 | buildSettings = { 335 | ALWAYS_SEARCH_USER_PATHS = NO; 336 | CLANG_ANALYZER_NONNULL = YES; 337 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 338 | CLANG_CXX_LIBRARY = "libc++"; 339 | CLANG_ENABLE_MODULES = YES; 340 | CLANG_ENABLE_OBJC_ARC = YES; 341 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 342 | CLANG_WARN_BOOL_CONVERSION = YES; 343 | CLANG_WARN_COMMA = YES; 344 | CLANG_WARN_CONSTANT_CONVERSION = YES; 345 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 346 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 347 | CLANG_WARN_EMPTY_BODY = YES; 348 | CLANG_WARN_ENUM_CONVERSION = YES; 349 | CLANG_WARN_INFINITE_RECURSION = YES; 350 | CLANG_WARN_INT_CONVERSION = YES; 351 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 352 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 353 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 354 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 355 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 356 | CLANG_WARN_STRICT_PROTOTYPES = YES; 357 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 358 | CLANG_WARN_UNREACHABLE_CODE = YES; 359 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 360 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 361 | COPY_PHASE_STRIP = NO; 362 | DEBUG_INFORMATION_FORMAT = dwarf; 363 | ENABLE_STRICT_OBJC_MSGSEND = YES; 364 | ENABLE_TESTABILITY = YES; 365 | GCC_C_LANGUAGE_STANDARD = gnu99; 366 | GCC_DYNAMIC_NO_PIC = NO; 367 | GCC_NO_COMMON_BLOCKS = YES; 368 | GCC_OPTIMIZATION_LEVEL = 0; 369 | GCC_PREPROCESSOR_DEFINITIONS = ( 370 | "DEBUG=1", 371 | "$(inherited)", 372 | ); 373 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 374 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 375 | GCC_WARN_UNDECLARED_SELECTOR = YES; 376 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 377 | GCC_WARN_UNUSED_FUNCTION = YES; 378 | GCC_WARN_UNUSED_VARIABLE = YES; 379 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 380 | MTL_ENABLE_DEBUG_INFO = YES; 381 | ONLY_ACTIVE_ARCH = YES; 382 | SDKROOT = iphoneos; 383 | TARGETED_DEVICE_FAMILY = "1,2"; 384 | }; 385 | name = Debug; 386 | }; 387 | 97C147041CF9000F007C117D /* Release */ = { 388 | isa = XCBuildConfiguration; 389 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 390 | buildSettings = { 391 | ALWAYS_SEARCH_USER_PATHS = NO; 392 | CLANG_ANALYZER_NONNULL = YES; 393 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 394 | CLANG_CXX_LIBRARY = "libc++"; 395 | CLANG_ENABLE_MODULES = YES; 396 | CLANG_ENABLE_OBJC_ARC = YES; 397 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 398 | CLANG_WARN_BOOL_CONVERSION = YES; 399 | CLANG_WARN_COMMA = YES; 400 | CLANG_WARN_CONSTANT_CONVERSION = YES; 401 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 402 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 403 | CLANG_WARN_EMPTY_BODY = YES; 404 | CLANG_WARN_ENUM_CONVERSION = YES; 405 | CLANG_WARN_INFINITE_RECURSION = YES; 406 | CLANG_WARN_INT_CONVERSION = YES; 407 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 408 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 409 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 410 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 411 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 412 | CLANG_WARN_STRICT_PROTOTYPES = YES; 413 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 414 | CLANG_WARN_UNREACHABLE_CODE = YES; 415 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 416 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 417 | COPY_PHASE_STRIP = NO; 418 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 419 | ENABLE_NS_ASSERTIONS = NO; 420 | ENABLE_STRICT_OBJC_MSGSEND = YES; 421 | GCC_C_LANGUAGE_STANDARD = gnu99; 422 | GCC_NO_COMMON_BLOCKS = YES; 423 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 424 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 425 | GCC_WARN_UNDECLARED_SELECTOR = YES; 426 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 427 | GCC_WARN_UNUSED_FUNCTION = YES; 428 | GCC_WARN_UNUSED_VARIABLE = YES; 429 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 430 | MTL_ENABLE_DEBUG_INFO = NO; 431 | SDKROOT = iphoneos; 432 | SUPPORTED_PLATFORMS = iphoneos; 433 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 434 | TARGETED_DEVICE_FAMILY = "1,2"; 435 | VALIDATE_PRODUCT = YES; 436 | }; 437 | name = Release; 438 | }; 439 | 97C147061CF9000F007C117D /* Debug */ = { 440 | isa = XCBuildConfiguration; 441 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 442 | buildSettings = { 443 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 444 | CLANG_ENABLE_MODULES = YES; 445 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 446 | ENABLE_BITCODE = NO; 447 | FRAMEWORK_SEARCH_PATHS = ( 448 | "$(inherited)", 449 | "$(PROJECT_DIR)/Flutter", 450 | ); 451 | INFOPLIST_FILE = Runner/Info.plist; 452 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 453 | LIBRARY_SEARCH_PATHS = ( 454 | "$(inherited)", 455 | "$(PROJECT_DIR)/Flutter", 456 | ); 457 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterProviderExamples; 458 | PRODUCT_NAME = "$(TARGET_NAME)"; 459 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 460 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 461 | SWIFT_VERSION = 5.0; 462 | VERSIONING_SYSTEM = "apple-generic"; 463 | }; 464 | name = Debug; 465 | }; 466 | 97C147071CF9000F007C117D /* Release */ = { 467 | isa = XCBuildConfiguration; 468 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 469 | buildSettings = { 470 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 471 | CLANG_ENABLE_MODULES = YES; 472 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 473 | ENABLE_BITCODE = NO; 474 | FRAMEWORK_SEARCH_PATHS = ( 475 | "$(inherited)", 476 | "$(PROJECT_DIR)/Flutter", 477 | ); 478 | INFOPLIST_FILE = Runner/Info.plist; 479 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 480 | LIBRARY_SEARCH_PATHS = ( 481 | "$(inherited)", 482 | "$(PROJECT_DIR)/Flutter", 483 | ); 484 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterProviderExamples; 485 | PRODUCT_NAME = "$(TARGET_NAME)"; 486 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 487 | SWIFT_VERSION = 5.0; 488 | VERSIONING_SYSTEM = "apple-generic"; 489 | }; 490 | name = Release; 491 | }; 492 | /* End XCBuildConfiguration section */ 493 | 494 | /* Begin XCConfigurationList section */ 495 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 496 | isa = XCConfigurationList; 497 | buildConfigurations = ( 498 | 97C147031CF9000F007C117D /* Debug */, 499 | 97C147041CF9000F007C117D /* Release */, 500 | 249021D3217E4FDB00AE95B9 /* Profile */, 501 | ); 502 | defaultConfigurationIsVisible = 0; 503 | defaultConfigurationName = Release; 504 | }; 505 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 506 | isa = XCConfigurationList; 507 | buildConfigurations = ( 508 | 97C147061CF9000F007C117D /* Debug */, 509 | 97C147071CF9000F007C117D /* Release */, 510 | 249021D4217E4FDB00AE95B9 /* Profile */, 511 | ); 512 | defaultConfigurationIsVisible = 0; 513 | defaultConfigurationName = Release; 514 | }; 515 | /* End XCConfigurationList section */ 516 | }; 517 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 518 | } 519 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaboc/flutter_provider_examples/38017e4f0022c6d85e3b9df8e05cbb04bed8d403/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaboc/flutter_provider_examples/38017e4f0022c6d85e3b9df8e05cbb04bed8d403/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/kaboc/flutter_provider_examples/38017e4f0022c6d85e3b9df8e05cbb04bed8d403/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/kaboc/flutter_provider_examples/38017e4f0022c6d85e3b9df8e05cbb04bed8d403/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/kaboc/flutter_provider_examples/38017e4f0022c6d85e3b9df8e05cbb04bed8d403/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/kaboc/flutter_provider_examples/38017e4f0022c6d85e3b9df8e05cbb04bed8d403/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/kaboc/flutter_provider_examples/38017e4f0022c6d85e3b9df8e05cbb04bed8d403/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/kaboc/flutter_provider_examples/38017e4f0022c6d85e3b9df8e05cbb04bed8d403/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/kaboc/flutter_provider_examples/38017e4f0022c6d85e3b9df8e05cbb04bed8d403/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/kaboc/flutter_provider_examples/38017e4f0022c6d85e3b9df8e05cbb04bed8d403/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/kaboc/flutter_provider_examples/38017e4f0022c6d85e3b9df8e05cbb04bed8d403/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/kaboc/flutter_provider_examples/38017e4f0022c6d85e3b9df8e05cbb04bed8d403/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/kaboc/flutter_provider_examples/38017e4f0022c6d85e3b9df8e05cbb04bed8d403/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/kaboc/flutter_provider_examples/38017e4f0022c6d85e3b9df8e05cbb04bed8d403/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaboc/flutter_provider_examples/38017e4f0022c6d85e3b9df8e05cbb04bed8d403/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaboc/flutter_provider_examples/38017e4f0022c6d85e3b9df8e05cbb04bed8d403/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaboc/flutter_provider_examples/38017e4f0022c6d85e3b9df8e05cbb04bed8d403/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaboc/flutter_provider_examples/38017e4f0022c6d85e3b9df8e05cbb04bed8d403/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | flutter_provider_examples 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/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" -------------------------------------------------------------------------------- /lib/blocs/counter_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | class CounterBloc { 4 | final _valueController = StreamController(); 5 | Stream get value => _valueController.stream; 6 | 7 | int _number = 0; 8 | 9 | void increment() { 10 | _number++; 11 | _valueController.sink.add(_number); 12 | } 13 | 14 | void dispose() { 15 | _valueController.close(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import './pages/list.dart'; 3 | 4 | void main() => runApp( 5 | MaterialApp( 6 | home: ListPage(), 7 | title: 'provider examples', 8 | theme: ThemeData( 9 | textTheme: const TextTheme( 10 | bodyText2: TextStyle(fontSize: 48.0), 11 | ), 12 | ), 13 | ), 14 | ); 15 | -------------------------------------------------------------------------------- /lib/models/change_notifier_counter.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | 3 | class CnCounter with ChangeNotifier { 4 | int _number = 0; 5 | int get number => _number; 6 | 7 | void increment() { 8 | _number++; 9 | notifyListeners(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /lib/models/dependency_injection_counter.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | 3 | abstract class CounterInterface with ChangeNotifier { 4 | int _number = 0; 5 | 6 | int get number => _number; 7 | String get numberString; 8 | 9 | void setNumber(int number) => _number = number; 10 | 11 | void increment() { 12 | _number++; 13 | notifyListeners(); 14 | } 15 | } 16 | 17 | class DecCounter extends CounterInterface { 18 | @override 19 | String get numberString => _number.toString(); 20 | } 21 | 22 | class BinCounter extends CounterInterface { 23 | @override 24 | String get numberString => _number.toRadixString(2); 25 | } 26 | 27 | class CounterContainer with ChangeNotifier { 28 | CounterInterface _counter; 29 | 30 | CounterInterface get counter => _counter; 31 | 32 | set newCounter(CounterInterface counter) { 33 | _counter = counter; 34 | notifyListeners(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/models/hex_counter.dart: -------------------------------------------------------------------------------- 1 | class HexCounter { 2 | HexCounter(); 3 | 4 | int _decimal; 5 | 6 | set newValue(int newValue) => _decimal = newValue; 7 | 8 | String get hex => _decimal.toRadixString(16); 9 | } 10 | -------------------------------------------------------------------------------- /lib/models/reassembling_counter.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import 'package:provider/provider.dart'; 4 | 5 | class ReassemblingCounterNotifier extends ValueNotifier 6 | with ReassembleHandler { 7 | ReassemblingCounterNotifier(this.locator) : super(0); 8 | 9 | Locator locator; 10 | 11 | @override 12 | void reassemble() { 13 | increment(); 14 | _showRebuild(); 15 | } 16 | 17 | void increment() { 18 | value++; 19 | } 20 | 21 | void _showRebuild() { 22 | locator>().currentState.showSnackBar( 23 | const SnackBar( 24 | duration: Duration(milliseconds: 600), 25 | behavior: SnackBarBehavior.floating, 26 | content: Text('Hot reloaded.'), 27 | ), 28 | ); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/models/value_notifier_counter.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | 3 | class VnCounter extends ValueNotifier { 4 | VnCounter() : super(0); 5 | 6 | void increment() => value++; 7 | } 8 | -------------------------------------------------------------------------------- /lib/pages/change_notifier_provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:provider/provider.dart'; 3 | import '../models/change_notifier_counter.dart'; 4 | 5 | class CnProviderPage extends StatelessWidget { 6 | const CnProviderPage(); 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | return ChangeNotifierProvider( 11 | create: (_) => CnCounter(), 12 | child: Scaffold( 13 | appBar: AppBar( 14 | title: const Text('ChangeNotifierProvider()'), 15 | ), 16 | body: const _CounterText(), 17 | floatingActionButton: const _FloatingButton(), 18 | ), 19 | ); 20 | } 21 | } 22 | 23 | class _FloatingButton extends StatelessWidget { 24 | const _FloatingButton(); 25 | 26 | @override 27 | Widget build(BuildContext context) { 28 | return FloatingActionButton( 29 | // OK 30 | // - onPressed: () => context.read().increment() 31 | // - onPressed: context.watch().increment 32 | // Bad 33 | // - onPressed: context.read().increment 34 | // - onPressed: () => context.watch().increment() 35 | onPressed: () => context.read().increment(), 36 | child: const Icon(Icons.add), 37 | ); 38 | } 39 | } 40 | 41 | class _CounterText extends StatelessWidget { 42 | const _CounterText(); 43 | 44 | @override 45 | Widget build(BuildContext context) { 46 | final number = context.select((CnCounter counter) => counter.number); 47 | 48 | return Center( 49 | child: Text(number.toString()), 50 | ); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /lib/pages/change_notifier_provider_value.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:provider/provider.dart'; 3 | import '../models/change_notifier_counter.dart'; 4 | 5 | class CnProviderValuePage extends StatefulWidget { 6 | const CnProviderValuePage(); 7 | 8 | @override 9 | _CnProviderValueState createState() => _CnProviderValueState(); 10 | } 11 | 12 | class _CnProviderValueState extends State { 13 | final _counter = CnCounter(); 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return ChangeNotifierProvider.value( 18 | value: _counter, 19 | child: Scaffold( 20 | appBar: AppBar( 21 | title: const Text('ChangeNotifierProvider.value()'), 22 | ), 23 | body: const _CounterText(), 24 | floatingActionButton: FloatingActionButton( 25 | onPressed: _counter.increment, 26 | child: const Icon(Icons.add), 27 | ), 28 | ), 29 | ); 30 | } 31 | 32 | @override 33 | void dispose() { 34 | _counter.dispose(); 35 | super.dispose(); 36 | } 37 | } 38 | 39 | class _CounterText extends StatelessWidget { 40 | const _CounterText(); 41 | 42 | @override 43 | Widget build(BuildContext context) { 44 | final number = context.select((CnCounter counter) => counter.number); 45 | 46 | return Center( 47 | child: Text(number.toString()), 48 | ); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /lib/pages/dependency_injection.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:provider/provider.dart'; 3 | import '../models/dependency_injection_counter.dart'; 4 | 5 | class DependencyInjectionPage extends StatelessWidget { 6 | const DependencyInjectionPage(); 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | return ChangeNotifierProvider( 11 | create: (_) => CounterContainer()..newCounter = DecCounter(), 12 | builder: (context, child) { 13 | return ChangeNotifierProvider.value( 14 | value: context.watch().counter, 15 | child: child, 16 | ); 17 | }, 18 | child: Scaffold( 19 | appBar: AppBar( 20 | title: const Text('Dependency Injection'), 21 | actions: const [_Switch()], 22 | ), 23 | body: const _CounterText(), 24 | floatingActionButton: const _FloatingButton(), 25 | ), 26 | ); 27 | } 28 | } 29 | 30 | class _Switch extends StatelessWidget { 31 | const _Switch(); 32 | 33 | @override 34 | Widget build(BuildContext context) { 35 | final container = context.watch(); 36 | final counter = container.counter; 37 | 38 | return Switch( 39 | value: counter.runtimeType == BinCounter, 40 | onChanged: (value) { 41 | container.newCounter = value ? BinCounter() : DecCounter(); 42 | container.counter.setNumber(counter.number); 43 | }, 44 | activeColor: Colors.white, 45 | ); 46 | } 47 | } 48 | 49 | class _FloatingButton extends StatelessWidget { 50 | const _FloatingButton(); 51 | 52 | @override 53 | Widget build(BuildContext context) { 54 | final type = 55 | context.select((CounterInterface counter) => counter.runtimeType); 56 | 57 | return FloatingActionButton( 58 | onPressed: () => context.read().increment(), 59 | child: const Icon(Icons.add), 60 | backgroundColor: type == DecCounter ? Colors.blue : Colors.green, 61 | ); 62 | } 63 | } 64 | 65 | class _CounterText extends StatelessWidget { 66 | const _CounterText(); 67 | 68 | @override 69 | Widget build(BuildContext context) { 70 | final counter = context.watch(); 71 | 72 | return Center( 73 | child: Column( 74 | mainAxisAlignment: MainAxisAlignment.center, 75 | children: [ 76 | Text( 77 | counter.runtimeType.toString(), 78 | style: const TextStyle(fontSize: 16.0), 79 | ), 80 | Text(counter.numberString), 81 | ], 82 | ), 83 | ); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /lib/pages/future_provider.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:provider/provider.dart'; 4 | 5 | class FutureProviderPage extends StatelessWidget { 6 | const FutureProviderPage(); 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | return FutureProvider( 11 | create: (_) => Future.delayed( 12 | const Duration(seconds: 3), 13 | () => '3 seconds elapsed.', 14 | ), 15 | initialData: 'Wait for 3 seconds...', 16 | child: Scaffold( 17 | appBar: AppBar( 18 | title: const Text('FutureProvider()'), 19 | ), 20 | body: const _FutureText(), 21 | ), 22 | ); 23 | } 24 | } 25 | 26 | class _FutureText extends StatelessWidget { 27 | const _FutureText(); 28 | 29 | @override 30 | Widget build(BuildContext context) { 31 | final description = context.watch(); 32 | 33 | return Center( 34 | child: Text( 35 | description, 36 | style: const TextStyle(fontSize: 20.0), 37 | ), 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/pages/list.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'change_notifier_provider.dart'; 3 | import 'change_notifier_provider_value.dart'; 4 | import 'dependency_injection.dart'; 5 | import 'future_provider.dart'; 6 | import 'listenable_provider.dart'; 7 | import 'provider.dart'; 8 | import 'provider_value.dart'; 9 | import 'proxy_provider.dart'; 10 | import 'proxy_provider0.dart'; 11 | import 'reassemble_handler.dart'; 12 | import 'selector.dart'; 13 | import 'stream_provider.dart'; 14 | import 'stream_provider_value.dart'; 15 | import 'value_listenable_provider.dart'; 16 | import 'value_listenable_provider_value.dart'; 17 | 18 | class ListPage extends StatelessWidget { 19 | @override 20 | Widget build(BuildContext context) { 21 | return Scaffold( 22 | appBar: AppBar(title: const Text('provider examples')), 23 | body: ListView( 24 | children: const [ 25 | _ListTile(title: 'Provider()', page: ProviderPage()), 26 | _ListTile(title: 'Provider.value()', page: ProviderValuePage()), 27 | _ListTile(title: 'StreamProvider()', page: StreamProviderPage()), 28 | _ListTile(title: 'StreamProvider.value()', page: StreamProviderValuePage()), 29 | _ListTile(title: 'ChangeNotifierProvider()', page: CnProviderPage()), 30 | _ListTile(title: 'ChangeNotifierProvider.value()', page: CnProviderValuePage()), 31 | _ListTile(title: 'ValueListenableProvider()', page: VlProviderPage()), 32 | _ListTile(title: 'ValueListenableProvider.value()', page: VlProviderValuePage()), 33 | _ListTile(title: 'ListenableProvider()', page: ListenableProviderPage()), 34 | _ListTile(title: 'FutureProvider()', page: FutureProviderPage()), 35 | _ListTile(title: 'ProxyProvider()', page: ProxyProviderPage()), 36 | _ListTile(title: 'ProxyProvider0()', page: ProxyProvider0Page()), 37 | _ListTile(title: 'Selector()', page: SelectorPage()), 38 | _ListTile(title: 'ReassembleHandler', page: ReassembleHandlerPage()), 39 | _ListTile(title: 'Dependency Injection', page: DependencyInjectionPage()), 40 | ], 41 | ), 42 | ); 43 | } 44 | } 45 | 46 | class _ListTile extends StatelessWidget { 47 | const _ListTile({@required this.title, @required this.page}); 48 | 49 | final String title; 50 | final Widget page; 51 | 52 | @override 53 | Widget build(BuildContext context) { 54 | return ListTile( 55 | title: Text(title), 56 | trailing: const Icon(Icons.keyboard_arrow_right), 57 | onTap: () => Navigator.of(context).push( 58 | MaterialPageRoute(builder: (_) => page), 59 | ), 60 | ); 61 | } 62 | } 63 | 64 | -------------------------------------------------------------------------------- /lib/pages/listenable_provider.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math' as math; 2 | import 'package:flutter/material.dart'; 3 | import 'package:provider/provider.dart'; 4 | 5 | class ListenableProviderPage extends StatefulWidget { 6 | const ListenableProviderPage(); 7 | 8 | @override 9 | _ListenableProviderState createState() => _ListenableProviderState(); 10 | } 11 | 12 | class _ListenableProviderState extends State 13 | with SingleTickerProviderStateMixin { 14 | @override 15 | Widget build(BuildContext context) { 16 | return ListenableProvider( 17 | create: (_) => AnimationController( 18 | duration: const Duration(seconds: 10), 19 | vsync: this, 20 | )..repeat(), 21 | dispose: (_, controller) => controller.dispose(), 22 | child: Scaffold( 23 | appBar: AppBar( 24 | title: const Text('ListenableProvider()'), 25 | ), 26 | body: const Center( 27 | child: _Spinner(), 28 | ), 29 | ), 30 | ); 31 | } 32 | } 33 | 34 | class _Spinner extends StatelessWidget { 35 | const _Spinner(); 36 | 37 | @override 38 | Widget build(BuildContext context) { 39 | final value = 40 | context.select((AnimationController controller) => controller.value); 41 | 42 | return Transform.rotate( 43 | angle: value * 2.0 * math.pi, 44 | child: const SizedBox( 45 | width: 200.0, 46 | height: 200.0, 47 | child: DecoratedBox( 48 | decoration: BoxDecoration(color: Colors.green), 49 | ), 50 | ), 51 | ); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /lib/pages/provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:provider/provider.dart'; 3 | import '../blocs/counter_bloc.dart'; 4 | 5 | class ProviderPage extends StatelessWidget { 6 | const ProviderPage(); 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | return Provider( 11 | create: (_) => CounterBloc(), 12 | dispose: (_, bloc) => bloc.dispose(), 13 | child: Scaffold( 14 | appBar: AppBar( 15 | title: const Text('Provider()'), 16 | ), 17 | body: const _CounterText(), 18 | floatingActionButton: _floatingButton(), 19 | ), 20 | ); 21 | } 22 | 23 | Widget _floatingButton() { 24 | // Using Consumer here rather than Selector does not affect the performance 25 | // badly because CounterBloc is not ChangeNotifier, meaning that changes of 26 | // values in CounterBloc does not trigger rebuilds. 27 | return Consumer( 28 | builder: (_, bloc, child) { 29 | return FloatingActionButton( 30 | onPressed: bloc.increment, 31 | child: child, 32 | ); 33 | }, 34 | child: const Icon(Icons.add), 35 | ); 36 | } 37 | } 38 | 39 | class _CounterText extends StatelessWidget { 40 | const _CounterText(); 41 | 42 | @override 43 | Widget build(BuildContext context) { 44 | // Using context.read() inside build() causes an exception. 45 | // Either of Provider.of(), context.watch() or context.select() has to be 46 | // used instead. 47 | final bloc = Provider.of(context, listen: false); 48 | 49 | return StreamBuilder( 50 | stream: bloc.value, 51 | initialData: 0, 52 | builder: (_, snapshot) { 53 | return Center( 54 | child: Text(snapshot.data.toString()), 55 | ); 56 | }, 57 | ); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /lib/pages/provider_value.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:provider/provider.dart'; 3 | import '../blocs/counter_bloc.dart'; 4 | 5 | class ProviderValuePage extends StatefulWidget { 6 | const ProviderValuePage(); 7 | 8 | @override 9 | _ProviderValueState createState() => _ProviderValueState(); 10 | } 11 | 12 | class _ProviderValueState extends State { 13 | final _bloc = CounterBloc(); 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return Provider.value( 18 | value: _bloc, 19 | child: Scaffold( 20 | appBar: AppBar( 21 | title: const Text('Provider.value()'), 22 | ), 23 | body: const _CounterText(), 24 | floatingActionButton: FloatingActionButton( 25 | onPressed: _bloc.increment, 26 | child: const Icon(Icons.add), 27 | ), 28 | ) 29 | ); 30 | } 31 | 32 | @override 33 | void dispose() { 34 | _bloc.dispose(); 35 | super.dispose(); 36 | } 37 | } 38 | 39 | class _CounterText extends StatelessWidget { 40 | const _CounterText(); 41 | 42 | @override 43 | Widget build(BuildContext context) { 44 | final bloc = Provider.of(context, listen: false); 45 | 46 | return StreamBuilder( 47 | stream: bloc.value, 48 | initialData: 0, 49 | builder: (_, snapshot) { 50 | return Center( 51 | child: Text(snapshot.data.toString()), 52 | ); 53 | }, 54 | ); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /lib/pages/proxy_provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:provider/provider.dart'; 3 | import '../models/hex_counter.dart'; 4 | import '../models/value_notifier_counter.dart'; 5 | 6 | class ProxyProviderPage extends StatelessWidget { 7 | const ProxyProviderPage(); 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return MultiProvider( 12 | providers: [ 13 | ChangeNotifierProvider( 14 | create: (_) => VnCounter(), 15 | ), 16 | ProxyProvider( 17 | create: (_) => HexCounter(), 18 | update: (_, decCounter, prevHexCounter) => 19 | prevHexCounter..newValue = decCounter.value, 20 | ), 21 | ], 22 | child: Scaffold( 23 | appBar: AppBar( 24 | title: const Text('ProxyProvider()'), 25 | ), 26 | body: const _CounterResults(), 27 | floatingActionButton: const _FloatingButton(), 28 | ), 29 | ); 30 | } 31 | } 32 | 33 | class _FloatingButton extends StatelessWidget { 34 | const _FloatingButton(); 35 | 36 | @override 37 | Widget build(BuildContext context) { 38 | return FloatingActionButton( 39 | onPressed: () => context.read().increment(), 40 | child: const Icon(Icons.add), 41 | ); 42 | } 43 | } 44 | 45 | class _CounterResults extends StatelessWidget { 46 | const _CounterResults(); 47 | 48 | @override 49 | Widget build(BuildContext context) { 50 | final dec = context.select((VnCounter counter) => counter.value); 51 | final hex = context.select((HexCounter counter) => counter.hex); 52 | 53 | return Center( 54 | child: Column( 55 | mainAxisAlignment: MainAxisAlignment.center, 56 | children: [ 57 | const Text( 58 | 'Decimal', 59 | style: TextStyle(fontSize: 16.0), 60 | ), 61 | Text(dec.toString()), 62 | const SizedBox(height: 32.0), 63 | const Text( 64 | 'Hexadecimal', 65 | style: TextStyle(fontSize: 16.0), 66 | ), 67 | Text(hex), 68 | ], 69 | ), 70 | ); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /lib/pages/proxy_provider0.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:provider/provider.dart'; 3 | import '../models/hex_counter.dart'; 4 | import '../models/value_notifier_counter.dart'; 5 | 6 | class ProxyProvider0Page extends StatelessWidget { 7 | const ProxyProvider0Page(); 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return ChangeNotifierProvider( 12 | create: (_) => VnCounter(), 13 | builder: (context, child) => ProxyProvider0( 14 | create: (_) => HexCounter(), 15 | update: (context, prev) => prev 16 | ..newValue = context.select((VnCounter vnCounter) => vnCounter.value), 17 | child: child, 18 | ), 19 | child: Scaffold( 20 | appBar: AppBar( 21 | title: const Text('ProxyProvider0()'), 22 | ), 23 | body: const _CounterResults(), 24 | floatingActionButton: const _FloatingButton(), 25 | ), 26 | ); 27 | } 28 | } 29 | 30 | class _FloatingButton extends StatelessWidget { 31 | const _FloatingButton(); 32 | 33 | @override 34 | Widget build(BuildContext context) { 35 | return FloatingActionButton( 36 | onPressed: () => context.read().increment(), 37 | child: const Icon(Icons.add), 38 | ); 39 | } 40 | } 41 | 42 | class _CounterResults extends StatelessWidget { 43 | const _CounterResults(); 44 | 45 | @override 46 | Widget build(BuildContext context) { 47 | final dec = context.select((VnCounter counter) => counter.value); 48 | final hex = context.select((HexCounter counter) => counter.hex); 49 | 50 | return Center( 51 | child: Column( 52 | mainAxisAlignment: MainAxisAlignment.center, 53 | children: [ 54 | const Text( 55 | 'Decimal', 56 | style: TextStyle(fontSize: 16.0), 57 | ), 58 | Text(dec.toString()), 59 | const SizedBox(height: 32.0), 60 | const Text( 61 | 'Hexadecimal', 62 | style: TextStyle(fontSize: 16.0), 63 | ), 64 | Text(hex), 65 | ], 66 | ), 67 | ); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /lib/pages/reassemble_handler.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:provider/provider.dart'; 3 | import '../models/reassembling_counter.dart'; 4 | 5 | class ReassembleHandlerPage extends StatelessWidget { 6 | const ReassembleHandlerPage(); 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | return MultiProvider( 11 | providers: [ 12 | Provider>( 13 | create: (_) => GlobalKey(), 14 | ), 15 | ChangeNotifierProvider( 16 | create: (context) => ReassemblingCounterNotifier(context.read), 17 | ), 18 | ], 19 | builder: (context, child) => Scaffold( 20 | key: context.watch>(), 21 | appBar: AppBar( 22 | title: const Text('ReassembleHandler'), 23 | ), 24 | body: child, 25 | floatingActionButton: const _FloatingButton(), 26 | ), 27 | child: const Padding( 28 | padding: EdgeInsets.all(32.0), 29 | child: _CounterText(), 30 | ), 31 | ); 32 | } 33 | } 34 | 35 | class _FloatingButton extends StatelessWidget { 36 | const _FloatingButton(); 37 | 38 | @override 39 | Widget build(BuildContext context) { 40 | return FloatingActionButton( 41 | child: Icon(Icons.add), 42 | onPressed: () => context.read().increment(), 43 | ); 44 | } 45 | } 46 | 47 | class _CounterText extends StatelessWidget { 48 | const _CounterText(); 49 | 50 | @override 51 | Widget build(BuildContext context) { 52 | final value = context.watch().value; 53 | 54 | return Center( 55 | child: Column( 56 | mainAxisAlignment: MainAxisAlignment.center, 57 | children: [ 58 | const Text( 59 | 'Not only tapping on the FAB but also hot reloading ' 60 | 'increments the counter value.\n\n' 61 | 'To see it happen, hot reload the app, or press the "Redraw" ' 62 | 'button to simulate the redraw that occurs after a hot reload.', 63 | textAlign: TextAlign.center, 64 | style: TextStyle(fontSize: 15.0), 65 | ), 66 | const SizedBox(height: 16.0), 67 | Text(value.toString()), 68 | const SizedBox(height: 16.0), 69 | RaisedButton( 70 | child: const Text('Redraw'), 71 | onPressed: () { 72 | WidgetsBinding.instance.reassembleApplication(); 73 | }, 74 | ), 75 | ], 76 | ), 77 | ); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /lib/pages/selector.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:provider/provider.dart'; 3 | import '../models/change_notifier_counter.dart'; 4 | 5 | class SelectorPage extends StatelessWidget { 6 | const SelectorPage(); 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | return ChangeNotifierProvider( 11 | create: (_) => CnCounter(), 12 | child: Scaffold( 13 | appBar: AppBar( 14 | title: const Text('Selector()'), 15 | ), 16 | body: const _CounterText(), 17 | floatingActionButton: const _FloatingButton(), 18 | ), 19 | ); 20 | } 21 | } 22 | 23 | class _FloatingButton extends StatelessWidget { 24 | const _FloatingButton(); 25 | 26 | @override 27 | Widget build(BuildContext context) { 28 | return FloatingActionButton( 29 | onPressed: () => context.read().increment(), 30 | child: const Icon(Icons.add), 31 | ); 32 | } 33 | } 34 | 35 | class _CounterText extends StatelessWidget { 36 | const _CounterText(); 37 | 38 | @override 39 | Widget build(BuildContext context) { 40 | return Center( 41 | child: Column( 42 | mainAxisAlignment: MainAxisAlignment.center, 43 | children: [ 44 | Selector( 45 | selector: (_, counter) => counter.number, 46 | builder: (_, number, __) => Text(number.toString()), 47 | ), 48 | const SizedBox(height: 32.0), 49 | const Text( 50 | 'Only even', 51 | style: TextStyle(fontSize: 16.0), 52 | ), 53 | Selector( 54 | selector: (_, counter) => counter.number, 55 | shouldRebuild: (_, next) => next.isEven, 56 | builder: (_, number, __) => Text(number.toString()), 57 | ), 58 | ], 59 | ), 60 | ); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /lib/pages/stream_provider.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:provider/provider.dart'; 4 | 5 | class StreamProviderPage extends StatefulWidget { 6 | const StreamProviderPage(); 7 | 8 | @override 9 | _StreamProviderState createState() => _StreamProviderState(); 10 | } 11 | 12 | class _StreamProviderState extends State { 13 | final _streamController = StreamController(); 14 | int _number = 0; 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return StreamProvider( 19 | create: (_) => _streamController.stream, 20 | initialData: 0, 21 | child: Scaffold( 22 | appBar: AppBar( 23 | title: const Text('StreamProvider()'), 24 | ), 25 | body: const _CounterText(), 26 | floatingActionButton: FloatingActionButton( 27 | onPressed: () => _streamController.sink.add(++_number), 28 | child: const Icon(Icons.add), 29 | ), 30 | ), 31 | ); 32 | } 33 | 34 | @override 35 | void dispose() { 36 | _streamController.close(); 37 | super.dispose(); 38 | } 39 | } 40 | 41 | class _CounterText extends StatelessWidget { 42 | const _CounterText(); 43 | 44 | @override 45 | Widget build(BuildContext context) { 46 | final number = context.watch(); 47 | 48 | return Center( 49 | child: Text(number.toString()), 50 | ); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /lib/pages/stream_provider_value.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:provider/provider.dart'; 4 | 5 | class StreamProviderValuePage extends StatefulWidget { 6 | const StreamProviderValuePage(); 7 | 8 | @override 9 | _StreamProviderValueState createState() => _StreamProviderValueState(); 10 | } 11 | 12 | class _StreamProviderValueState extends State { 13 | final _streamController = StreamController(); 14 | int _number = 0; 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return StreamProvider.value( 19 | value: _streamController.stream, 20 | initialData: 0, 21 | child: Scaffold( 22 | appBar: AppBar( 23 | title: const Text('StreamProvider.value()'), 24 | ), 25 | body: const _CounterText(), 26 | floatingActionButton: FloatingActionButton( 27 | onPressed: () => _streamController.sink.add(++_number), 28 | child: const Icon(Icons.add), 29 | ), 30 | ), 31 | ); 32 | } 33 | 34 | @override 35 | void dispose() { 36 | _streamController.close(); 37 | super.dispose(); 38 | } 39 | } 40 | 41 | class _CounterText extends StatelessWidget { 42 | const _CounterText(); 43 | 44 | @override 45 | Widget build(BuildContext context) { 46 | final number = context.watch(); 47 | 48 | return Center( 49 | child: Text(number.toString()), 50 | ); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /lib/pages/value_listenable_provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:provider/provider.dart'; 3 | import '../models/value_notifier_counter.dart'; 4 | 5 | class VlProviderPage extends StatelessWidget { 6 | const VlProviderPage(); 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | final counter = VnCounter(); 11 | 12 | return ValueListenableProvider( 13 | create: (_) => counter, 14 | child: Scaffold( 15 | appBar: AppBar( 16 | title: const Text('ValueListenableProvider()'), 17 | ), 18 | body: const _CounterText(), 19 | floatingActionButton: FloatingActionButton( 20 | onPressed: counter.increment, 21 | child: const Icon(Icons.add), 22 | ), 23 | ), 24 | ); 25 | } 26 | } 27 | 28 | class _CounterText extends StatelessWidget { 29 | const _CounterText(); 30 | 31 | @override 32 | Widget build(BuildContext context) { 33 | final number = context.watch(); 34 | 35 | return Center( 36 | child: Text(number.toString()), 37 | ); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/pages/value_listenable_provider_value.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:provider/provider.dart'; 3 | import '../models/value_notifier_counter.dart'; 4 | 5 | class VlProviderValuePage extends StatelessWidget { 6 | const VlProviderValuePage(); 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | final counter = VnCounter(); 11 | 12 | return ValueListenableProvider.value( 13 | value: counter, 14 | child: Scaffold( 15 | appBar: AppBar( 16 | title: const Text('ValueListenableProvider.value()'), 17 | ), 18 | body: const _CounterText(), 19 | floatingActionButton: FloatingActionButton( 20 | onPressed: counter.increment, 21 | child: const Icon(Icons.add), 22 | ), 23 | ), 24 | ); 25 | } 26 | } 27 | 28 | class _CounterText extends StatelessWidget { 29 | const _CounterText(); 30 | 31 | @override 32 | Widget build(BuildContext context) { 33 | final number = context.watch(); 34 | 35 | return Center( 36 | child: Text(number.toString()), 37 | ); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | characters: 5 | dependency: transitive 6 | description: 7 | name: characters 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "1.1.0-nullsafety.3" 11 | collection: 12 | dependency: transitive 13 | description: 14 | name: collection 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "1.15.0-nullsafety.3" 18 | flutter: 19 | dependency: "direct main" 20 | description: flutter 21 | source: sdk 22 | version: "0.0.0" 23 | meta: 24 | dependency: transitive 25 | description: 26 | name: meta 27 | url: "https://pub.dartlang.org" 28 | source: hosted 29 | version: "1.3.0-nullsafety.3" 30 | nested: 31 | dependency: transitive 32 | description: 33 | name: nested 34 | url: "https://pub.dartlang.org" 35 | source: hosted 36 | version: "0.0.4" 37 | provider: 38 | dependency: "direct main" 39 | description: 40 | name: provider 41 | url: "https://pub.dartlang.org" 42 | source: hosted 43 | version: "4.3.2+2" 44 | sky_engine: 45 | dependency: transitive 46 | description: flutter 47 | source: sdk 48 | version: "0.0.99" 49 | typed_data: 50 | dependency: transitive 51 | description: 52 | name: typed_data 53 | url: "https://pub.dartlang.org" 54 | source: hosted 55 | version: "1.3.0-nullsafety.3" 56 | vector_math: 57 | dependency: transitive 58 | description: 59 | name: vector_math 60 | url: "https://pub.dartlang.org" 61 | source: hosted 62 | version: "2.1.0-nullsafety.3" 63 | sdks: 64 | dart: ">=2.10.0-110 <2.11.0" 65 | flutter: ">=1.16.0" 66 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_provider_examples 2 | description: A new Flutter project. 3 | 4 | version: 1.0.0+1 5 | 6 | environment: 7 | sdk: ">=2.9.0 <3.0.0" 8 | 9 | dependencies: 10 | flutter: 11 | sdk: flutter 12 | 13 | provider: ^4.3.0 14 | 15 | flutter: 16 | uses-material-design: true 17 | --------------------------------------------------------------------------------