├── .gitignore
├── .metadata
├── README.md
├── analysis_options.yaml
├── android
├── .gitignore
├── app
│ ├── build.gradle
│ └── src
│ │ ├── debug
│ │ └── AndroidManifest.xml
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── kotlin
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── flutter_clean_architecture
│ │ │ │ └── MainActivity.kt
│ │ └── res
│ │ │ ├── drawable-v21
│ │ │ └── launch_background.xml
│ │ │ ├── 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-night
│ │ │ └── styles.xml
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── profile
│ │ └── AndroidManifest.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
└── settings.gradle
├── architecture-proposal.png
├── core
├── .gitignore
├── .metadata
├── CHANGELOG.md
├── README.md
├── lib
│ ├── core.dart
│ └── src
│ │ ├── config
│ │ └── app_config.dart
│ │ ├── di
│ │ └── locator.dart
│ │ ├── error
│ │ ├── exceptions.dart
│ │ └── failures.dart
│ │ └── localizations
│ │ ├── language_vi.dart
│ │ ├── languages.dart
│ │ ├── localizations_delegate.dart
│ │ └── strings.dart
├── pubspec.lock
├── pubspec.yaml
└── test
│ └── core_test.dart
├── data
├── .gitignore
├── .metadata
├── CHANGELOG.md
├── README.md
├── lib
│ ├── data.dart
│ └── src
│ │ ├── data_source
│ │ ├── local
│ │ │ └── shared_preferences_store.dart
│ │ ├── remote
│ │ │ ├── base
│ │ │ │ └── api_client.dart
│ │ │ ├── popup_api.dart
│ │ │ ├── regions_api.dart
│ │ │ └── screen_setting_api.dart
│ │ └── service
│ │ │ └── firebase_remote_config.dart
│ │ ├── di
│ │ └── locator.dart
│ │ ├── models
│ │ ├── list_response_model.dart
│ │ ├── metadata_model.dart
│ │ ├── popup_model.dart
│ │ ├── region_model.dart
│ │ └── screen_setting_model.dart
│ │ └── repository
│ │ ├── api_error_handle_repo_impl.dart
│ │ ├── base
│ │ └── base_repository.dart
│ │ ├── internet_status_repo_impl.dart
│ │ ├── popup_repo_impl.dart
│ │ ├── region_repo_impl.dart
│ │ └── screen_setting_repo_impl.dart
├── pubspec.lock
├── pubspec.yaml
└── test
│ ├── data_source
│ └── remote
│ │ └── screen_setting_api_test.dart
│ ├── data_test.dart
│ └── repository
│ └── internet_status_test.dart
├── domain
├── .gitignore
├── .metadata
├── CHANGELOG.md
├── README.md
├── lib
│ ├── domain.dart
│ └── src
│ │ ├── common
│ │ ├── error_type.dart
│ │ └── result.dart
│ │ ├── di
│ │ └── locator.dart
│ │ ├── entities
│ │ ├── list_response.dart
│ │ ├── metadata.dart
│ │ ├── popup.dart
│ │ ├── region.dart
│ │ ├── screen_setting.dart
│ │ └── validator.dart
│ │ ├── repositories
│ │ ├── api_error_handler_repo.dart
│ │ ├── internet_status_repo.dart
│ │ ├── popup_repo.dart
│ │ ├── region_repo.dart
│ │ └── screen_setting_repo.dart
│ │ └── usecase
│ │ ├── api_error_handler.dart
│ │ ├── base
│ │ └── use_case.dart
│ │ ├── check_internet_status.dart
│ │ ├── get_float_popup.dart
│ │ ├── get_home_screen_setting.dart
│ │ ├── get_region.dart
│ │ ├── get_regions.dart
│ │ ├── get_regions_local.dart
│ │ ├── get_shopping_screen_setting.dart
│ │ └── update_region.dart
├── pubspec.lock
├── pubspec.yaml
└── test
│ └── domain_test.dart
├── ios
├── .gitignore
├── Flutter
│ ├── AppFrameworkInfo.plist
│ ├── Debug.xcconfig
│ └── Release.xcconfig
├── Podfile
├── Podfile.lock
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ └── WorkspaceSettings.xcsettings
│ └── xcshareddata
│ │ └── xcschemes
│ │ ├── development.xcscheme
│ │ ├── production.xcscheme
│ │ └── staging.xcscheme
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ ├── IDEWorkspaceChecks.plist
│ │ └── WorkspaceSettings.xcsettings
└── 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
├── main.dart
├── main.dev.dart
├── main.prod.dart
├── main.staging.dart
└── presentation
│ ├── common
│ └── base_bloc.dart
│ ├── di
│ └── locator.dart
│ ├── extension
│ └── screen_setting.dart
│ ├── routes
│ ├── app_routes.dart
│ └── routes.dart
│ ├── screen
│ ├── app
│ │ ├── app.dart
│ │ ├── app_bloc.dart
│ │ └── app_state.dart
│ ├── app_bottom_bar
│ │ ├── app_bottom_bar.dart
│ │ ├── app_bottom_bar_bloc.dart
│ │ └── widget
│ │ │ ├── custom_bottom_app_bar.dart
│ │ │ └── custom_bottom_navigation_bar.dart
│ ├── home
│ │ ├── home_bloc.dart
│ │ ├── home_screen.dart
│ │ ├── home_setting_bloc.dart
│ │ └── widget
│ │ │ ├── home_bloc_container.dart
│ │ │ ├── home_search_bar.dart
│ │ │ └── home_sliver_app_bar.dart
│ ├── popup
│ │ ├── floating_popup
│ │ │ ├── floating_popup.dart
│ │ │ └── floating_popup_bloc.dart
│ │ └── region
│ │ │ ├── region_bloc.dart
│ │ │ └── region_dialog.dart
│ └── shopping
│ │ ├── shopping_bloc.dart
│ │ ├── shopping_screen.dart
│ │ ├── shopping_setting_bloc.dart
│ │ └── widget
│ │ ├── shopping_search_bar.dart
│ │ └── shopping_sliver_app_bar.dart
│ ├── values
│ ├── assets.dart
│ ├── constant.dart
│ ├── sizes.dart
│ └── themes.dart
│ └── widgets
│ ├── choose_region.dart
│ ├── custom_sliver_app_bar_delegate.dart
│ └── search_bar.dart
├── plugin
└── utils
│ ├── .gitignore
│ ├── .metadata
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── lib
│ └── utils.dart
│ ├── pubspec.lock
│ ├── pubspec.yaml
│ └── test
│ └── utils_test.dart
├── pubspec.lock
├── pubspec.yaml
├── test
└── widget_test.dart
└── tool
├── coverage.sh
└── generate_asset_metadata.sh
/.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 | **/ios/Flutter/.last_build_id
26 | .dart_tool/
27 | .flutter-plugins
28 | .flutter-plugins-dependencies
29 | .packages
30 | .pub-cache/
31 | .pub/
32 | /build/
33 |
34 | # Web related
35 | lib/generated_plugin_registrant.dart
36 |
37 | # Symbolication related
38 | app.*.symbols
39 |
40 | # Obfuscation related
41 | app.*.map.json
42 |
43 | # Android Studio will place build artifacts here
44 | /android/app/debug
45 | /android/app/profile
46 | /android/app/release
47 |
--------------------------------------------------------------------------------
/.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: 4cc385b4b84ac2f816d939a49ea1f328c4e0b48e
8 | channel: stable
9 |
10 | project_type: app
11 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Flutter Clean Architecture
2 | ```
3 | - Flutter v2.5.0
4 | - Clean Architecture
5 | - Presentation use Bloc
6 | ```
7 |
8 | # Technical architecture components
9 | - Clean Architecture
10 | - Dart rule analyze: pedantic
11 | - State management: flutter_bloc
12 | - Dependency injection: get_it
13 | - Network: dio
14 | - Unit test: Mockito
15 |
16 | ## Run
17 | ```
18 | flutter clean
19 | flutter pub get
20 | flutter packages pub run build_runner watch
21 |
22 | flutter run --flavor development -t lib/main.dev.dart
23 | flutter run --flavor staging -t lib/main.staging.dart
24 | flutter run --flavor product -t lib/main.product.dart
25 | ```
26 | ## Build Release
27 |
28 | - Android:
29 | ```
30 | flutter build apk --flavor development -t lib/main.dev.dart
31 | flutter build apk --flavor staging -t lib/main.staging.dart
32 | flutter build apk --flavor product -t lib/main.product.dart
33 | ```
34 | - iOS:
35 | ```
36 | flutter build ios --flavor development -t lib/main.dev.dart
37 | flutter build ios --flavor staging -t lib/main.staging.dart
38 | flutter build ios --flavor product -t lib/main.product.dart
39 | ```
40 |
41 | ## Refer
42 | - https://github.com/ResoCoder/flutter-tdd-clean-architecture-course
43 | - https://geekysingh.medium.com/clean-architecture-for-enterprise-flutter-application-dc254a71059
44 | - https://github.com/trunghieuvn/flutter-clean-architecture
45 | - https://github.com/vantrung8794/flutter_code_base
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | analyzer:
2 | exclude:
3 | - build/**
4 | # strong-mode:
5 | # implicit-casts: false
6 | errors:
7 | avoid_as: error
8 |
9 | ##https://dart-lang.github.io/linter/lints/
10 | linter:
11 | rules:
12 | # - always_put_control_body_on_new_line
13 | # - always_put_required_named_parameters_first
14 | # - always_specify_types
15 | - avoid_annotating_with_dynamic
16 | # - avoid_as
17 | # - avoid_bool_literals_in_conditional_expressions # under review (see #1068)
18 | # - avoid_catches_without_on_clauses
19 | - avoid_catching_errors
20 | # - avoid_classes_with_only_static_members
21 | # - avoid_double_and_int_checks # under review (see #1068)
22 | # - avoid_field_initializers_in_const_classes # under review (see #1068)
23 | # - avoid_function_literals_in_foreach_calls
24 | # - avoid_implementing_value_types
25 | # - avoid_js_rounded_ints # under review (see #1068)
26 | # - avoid_positional_boolean_parameters
27 | # - avoid_private_typedef_functions # under review (see #1068)
28 | - avoid_redundant_argument_values
29 | # - avoid_renaming_method_parameters # under review (see #1068)
30 | - avoid_returning_null
31 | - avoid_returning_null_for_future
32 | - avoid_returning_this
33 | - avoid_setters_without_getters
34 | # - avoid_single_cascade_in_expression_statements # under review (see #1068)
35 | - avoid_slow_async_io
36 | # - avoid_types_on_closure_parameters
37 | # - avoid_unused_constructor_parameters # under review (see #1068)
38 | # - avoid_void_async # under review (see #1068)
39 | - await_only_futures
40 | - camel_case_types
41 | - cancel_subscriptions
42 | # - cascade_invocations
43 | # - close_sinks # https://github.com/dart-lang/linter/issues/268
44 | - comment_references
45 | # - constant_identifier_names
46 | - control_flow_in_finally
47 | - directives_ordering
48 | - empty_statements
49 | # - file_names # under review (see #1068)
50 | - hash_and_equals
51 | - implementation_imports
52 | - invariant_booleans
53 | - iterable_contains_unrelated_type
54 | - join_return_with_assignment
55 | # - lines_longer_than_80_chars # under review (see #1068)
56 | - list_remove_unrelated_type
57 | - literal_only_boolean_expressions
58 | - no_adjacent_strings_in_list
59 | # - non_constant_identifier_names
60 | # - one_member_abstracts
61 | # - only_throw_errors
62 | - overridden_fields
63 | - package_api_docs
64 | - package_names
65 | - package_prefixed_library_names
66 | - parameter_assignments
67 | - prefer_asserts_in_initializer_lists
68 | # - prefer_bool_in_asserts # Deprecated
69 | # - prefer_const_constructors
70 | - prefer_const_constructors_in_immutables
71 | # - prefer_const_declarations # under review (see #1068)
72 | # - prefer_const_literals_to_create_immutables # under review (see #1068)
73 | - prefer_constructors_over_static_methods
74 | # - prefer_expression_function_bodies
75 | - prefer_final_fields
76 | # - prefer_final_locals
77 | - prefer_foreach
78 | # - prefer_function_declarations_over_variables
79 | - prefer_initializing_formals
80 | - prefer_inlined_adds
81 | - prefer_interpolation_to_compose_strings
82 | - prefer_is_not_operator
83 | # - prefer_mixin
84 | - prefer_null_aware_operators
85 | - prefer_relative_imports
86 | # - prefer_typing_uninitialized_variables # under review (see #1068)
87 | - prefer_void_to_null
88 | - provide_deprecation_message
89 | # - public_member_api_docs
90 | # - sort_constructors_first
91 | # - sort_pub_dependencies
92 | # - sort_unnamed_constructors_first
93 | # - super_goes_last
94 | - test_types_in_equals
95 | - throw_in_finally
96 | # - type_annotate_public_apis
97 | - unnecessary_brace_in_string_interps
98 | - unnecessary_getters_setters
99 | - unnecessary_lambdas
100 | - unnecessary_null_aware_assignments
101 | - unnecessary_overrides
102 | - unnecessary_parenthesis
103 | - unnecessary_statements
104 | - use_setters_to_change_properties
105 | - use_string_buffers
106 | - use_to_and_as_if_applicable
107 | - void_checks
108 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 | **/*.keystore
13 | **/*.jks
14 |
--------------------------------------------------------------------------------
/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 30
30 |
31 | compileOptions {
32 | sourceCompatibility JavaVersion.VERSION_1_8
33 | targetCompatibility JavaVersion.VERSION_1_8
34 | }
35 |
36 | kotlinOptions {
37 | jvmTarget = '1.8'
38 | }
39 |
40 | sourceSets {
41 | main.java.srcDirs += 'src/main/kotlin'
42 | }
43 |
44 | defaultConfig {
45 | applicationId "com.example.flutter_clean_architecture"
46 | minSdkVersion 16
47 | targetSdkVersion 30
48 | versionCode flutterVersionCode.toInteger()
49 | versionName flutterVersionName
50 | }
51 |
52 | flavorDimensions "env"
53 | productFlavors {
54 | development {
55 | dimension "env"
56 | applicationIdSuffix ".dev"
57 | versionNameSuffix "-dev"
58 | resValue "string", "app_name", "@string/app_name_dev"
59 | }
60 | staging {
61 | dimension "env"
62 | applicationIdSuffix ".staging"
63 | versionNameSuffix "-staging"
64 | resValue "string", "app_name", "@string/app_name_staging"
65 | }
66 | production {
67 | dimension "env"
68 | resValue "string", "app_name", "@string/app_name_release"
69 | }
70 | }
71 | }
72 |
73 | flutter {
74 | source '../..'
75 | }
76 |
77 | dependencies {
78 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
79 | }
80 |
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
9 |
16 |
20 |
23 |
28 |
31 |
32 |
33 |
34 |
35 |
36 |
38 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/flutter_clean_architecture/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.flutter_clean_architecture
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
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/vuitv/flutter_clean_architecture/d662127f5902eb1d6b95f912ebc99e11cbe561c7/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vuitv/flutter_clean_architecture/d662127f5902eb1d6b95f912ebc99e11cbe561c7/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vuitv/flutter_clean_architecture/d662127f5902eb1d6b95f912ebc99e11cbe561c7/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vuitv/flutter_clean_architecture/d662127f5902eb1d6b95f912ebc99e11cbe561c7/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vuitv/flutter_clean_architecture/d662127f5902eb1d6b95f912ebc99e11cbe561c7/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Flutter
4 | Flutter Staging
5 | Flutter Dev
6 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/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 | mavenCentral()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:4.1.0'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | mavenCentral()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | project.evaluationDependsOn(':app')
25 | }
26 |
27 | task clean(type: Delete) {
28 | delete rootProject.buildDir
29 | }
30 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/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-6.7-all.zip
7 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4 | def properties = new Properties()
5 |
6 | assert localPropertiesFile.exists()
7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
8 |
9 | def flutterSdkPath = properties.getProperty("flutter.sdk")
10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
12 |
--------------------------------------------------------------------------------
/architecture-proposal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vuitv/flutter_clean_architecture/d662127f5902eb1d6b95f912ebc99e11cbe561c7/architecture-proposal.png
--------------------------------------------------------------------------------
/core/.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 | # Android related
34 | **/android/**/gradle-wrapper.jar
35 | **/android/.gradle
36 | **/android/captures/
37 | **/android/gradlew
38 | **/android/gradlew.bat
39 | **/android/local.properties
40 | **/android/**/GeneratedPluginRegistrant.java
41 |
42 | # iOS/XCode related
43 | **/ios/**/*.mode1v3
44 | **/ios/**/*.mode2v3
45 | **/ios/**/*.moved-aside
46 | **/ios/**/*.pbxuser
47 | **/ios/**/*.perspectivev3
48 | **/ios/**/*sync/
49 | **/ios/**/.sconsign.dblite
50 | **/ios/**/.tags*
51 | **/ios/**/.vagrant/
52 | **/ios/**/DerivedData/
53 | **/ios/**/Icon?
54 | **/ios/**/Pods/
55 | **/ios/**/.symlinks/
56 | **/ios/**/profile
57 | **/ios/**/xcuserdata
58 | **/ios/.generated/
59 | **/ios/Flutter/App.framework
60 | **/ios/Flutter/Flutter.framework
61 | **/ios/Flutter/Flutter.podspec
62 | **/ios/Flutter/Generated.xcconfig
63 | **/ios/Flutter/ephemeral
64 | **/ios/Flutter/app.flx
65 | **/ios/Flutter/app.zip
66 | **/ios/Flutter/flutter_assets/
67 | **/ios/Flutter/flutter_export_environment.sh
68 | **/ios/ServiceDefinitions.json
69 | **/ios/Runner/GeneratedPluginRegistrant.*
70 |
71 | # Exceptions to above rules.
72 | !**/ios/**/default.mode1v3
73 | !**/ios/**/default.mode2v3
74 | !**/ios/**/default.pbxuser
75 | !**/ios/**/default.perspectivev3
76 | /coverage/
77 |
--------------------------------------------------------------------------------
/core/.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: f4abaa0735eba4dfd8f33f73363911d63931fe03
8 | channel: stable
9 |
10 | project_type: package
11 |
--------------------------------------------------------------------------------
/core/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 0.0.1
2 |
3 | * TODO: Describe initial release.
4 |
--------------------------------------------------------------------------------
/core/README.md:
--------------------------------------------------------------------------------
1 | # core
2 |
3 | A new Flutter project.
4 |
5 | ## Getting Started
6 |
7 | This project is a starting point for a Dart
8 | [package](https://flutter.dev/developing-packages/),
9 | a library module containing code that can be shared easily across
10 | multiple Flutter or Dart projects.
11 |
12 | For help getting started with Flutter, view our
13 | [online documentation](https://flutter.dev/docs), which offers tutorials,
14 | samples, guidance on mobile development, and a full API reference.
15 |
--------------------------------------------------------------------------------
/core/lib/core.dart:
--------------------------------------------------------------------------------
1 | library core;
2 |
3 | import 'src/config/app_config.dart';
4 | import 'src/di/locator.dart';
5 |
6 | export 'src/config/app_config.dart';
7 | export 'src/localizations/languages.dart';
8 | export 'src/localizations/localizations_delegate.dart';
9 | export 'src/localizations/strings.dart';
10 |
11 | class Core {
12 | static void init(Environment environment) {
13 | setupLocator(environment);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/core/lib/src/config/app_config.dart:
--------------------------------------------------------------------------------
1 | enum Environment { DEV, STAGING, PROD }
2 |
3 | class AppConfig {
4 | late Environment environment;
5 | late Map _config;
6 |
7 | String get baseUrl => _config[_Config.BASE_URL];
8 |
9 | AppConfig(this.environment) {
10 | switch (environment) {
11 | case Environment.DEV:
12 | _config = _Config.devConstants;
13 | break;
14 | case Environment.STAGING:
15 | _config = _Config.stagingConstants;
16 | break;
17 | case Environment.PROD:
18 | _config = _Config.prodConstants;
19 | break;
20 | }
21 | }
22 | }
23 |
24 | class _Config {
25 | static const BASE_URL = 'BASE_URL';
26 |
27 | static Map devConstants = {
28 | BASE_URL: 'https://api-dev',
29 | };
30 |
31 | static Map stagingConstants = {
32 | BASE_URL: 'https://api-staging',
33 | };
34 |
35 | static Map prodConstants = {
36 | BASE_URL: 'https://api-product',
37 | };
38 | }
39 |
--------------------------------------------------------------------------------
/core/lib/src/di/locator.dart:
--------------------------------------------------------------------------------
1 | import 'package:get_it/get_it.dart';
2 |
3 | import '../config/app_config.dart';
4 | import '../localizations/strings.dart';
5 |
6 | final locator = GetIt.instance..allowReassignment = true;
7 |
8 | void setupLocator(Environment environment) {
9 | locator.registerSingleton(AppConfig(environment));
10 | locator.registerLazySingleton(() => Strings());
11 | }
12 |
--------------------------------------------------------------------------------
/core/lib/src/error/exceptions.dart:
--------------------------------------------------------------------------------
1 | class ServerException implements Exception {}
2 |
3 | class CacheException implements Exception {}
4 |
--------------------------------------------------------------------------------
/core/lib/src/error/failures.dart:
--------------------------------------------------------------------------------
1 | import 'package:equatable/equatable.dart';
2 |
3 | abstract class Failure extends Equatable {
4 | @override
5 | List