├── .gitignore
├── .metadata
├── README.md
├── analysis_options.yaml
├── android
├── .gitignore
├── app
│ ├── build.gradle
│ └── src
│ │ ├── debug
│ │ └── AndroidManifest.xml
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── kotlin
│ │ │ └── com
│ │ │ │ └── kuldiiproject
│ │ │ │ └── tutorial_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
│ │ │ └── styles.xml
│ │ └── profile
│ │ └── AndroidManifest.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
└── settings.gradle
├── 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
│ │ └── Runner.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
└── RunnerTests
│ └── RunnerTests.swift
├── lib
├── core
│ ├── error
│ │ ├── exception.dart
│ │ └── failure.dart
│ └── routes
│ │ └── my_router.dart
├── features
│ └── profile
│ │ ├── data
│ │ ├── datasources
│ │ │ ├── local_datasource.dart
│ │ │ └── remote_datasource.dart
│ │ ├── models
│ │ │ ├── profile_model.dart
│ │ │ └── profile_model.g.dart
│ │ └── repositories
│ │ │ └── profile_repository_implementation.dart
│ │ ├── domain
│ │ ├── entities
│ │ │ └── profile.dart
│ │ ├── repositories
│ │ │ └── profile_repository.dart
│ │ └── usecases
│ │ │ ├── get_all_user.dart
│ │ │ └── get_user.dart
│ │ └── presentation
│ │ ├── bloc
│ │ ├── profile_bloc.dart
│ │ ├── profile_event.dart
│ │ └── profile_state.dart
│ │ └── pages
│ │ ├── all_users_page.dart
│ │ └── detail_user_page.dart
├── injection.dart
├── main.dart
└── observer.dart
├── linux
├── .gitignore
├── CMakeLists.txt
├── flutter
│ ├── CMakeLists.txt
│ ├── generated_plugin_registrant.cc
│ ├── generated_plugin_registrant.h
│ └── generated_plugins.cmake
├── main.cc
├── my_application.cc
└── my_application.h
├── macos
├── .gitignore
├── Flutter
│ ├── Flutter-Debug.xcconfig
│ ├── Flutter-Release.xcconfig
│ └── GeneratedPluginRegistrant.swift
├── Podfile
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
├── Runner
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── app_icon_1024.png
│ │ │ ├── app_icon_128.png
│ │ │ ├── app_icon_16.png
│ │ │ ├── app_icon_256.png
│ │ │ ├── app_icon_32.png
│ │ │ ├── app_icon_512.png
│ │ │ └── app_icon_64.png
│ ├── Base.lproj
│ │ └── MainMenu.xib
│ ├── Configs
│ │ ├── AppInfo.xcconfig
│ │ ├── Debug.xcconfig
│ │ ├── Release.xcconfig
│ │ └── Warnings.xcconfig
│ ├── DebugProfile.entitlements
│ ├── Info.plist
│ ├── MainFlutterWindow.swift
│ └── Release.entitlements
└── RunnerTests
│ └── RunnerTests.swift
├── pubspec.lock
├── pubspec.yaml
├── test
└── profile
│ ├── remote_datasource_test.dart
│ └── remote_datasource_test.mocks.dart
├── web
├── favicon.png
├── icons
│ ├── Icon-192.png
│ ├── Icon-512.png
│ ├── Icon-maskable-192.png
│ └── Icon-maskable-512.png
├── index.html
└── manifest.json
└── windows
├── .gitignore
├── CMakeLists.txt
├── flutter
├── CMakeLists.txt
├── generated_plugin_registrant.cc
├── generated_plugin_registrant.h
└── generated_plugins.cmake
└── runner
├── CMakeLists.txt
├── Runner.rc
├── flutter_window.cpp
├── flutter_window.h
├── main.cpp
├── resource.h
├── resources
└── app_icon.ico
├── runner.exe.manifest
├── utils.cpp
├── utils.h
├── win32_window.cpp
└── win32_window.h
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | migrate_working_dir/
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # The .vscode folder contains launch configuration and tasks you configure in
20 | # VS Code which you may wish to be included in version control, so this line
21 | # is commented out by default.
22 | #.vscode/
23 |
24 | # Flutter/Dart/Pub related
25 | **/doc/api/
26 | **/ios/Flutter/.last_build_id
27 | .dart_tool/
28 | .flutter-plugins
29 | .flutter-plugins-dependencies
30 | .pub-cache/
31 | .pub/
32 | /build/
33 |
34 | # Symbolication related
35 | app.*.symbols
36 |
37 | # Obfuscation related
38 | app.*.map.json
39 |
40 | # Android Studio will place build artifacts here
41 | /android/app/debug
42 | /android/app/profile
43 | /android/app/release
44 |
--------------------------------------------------------------------------------
/.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: "b0850beeb25f6d5b10426284f506557f66181b36"
8 | channel: "stable"
9 |
10 | project_type: app
11 |
12 | # Tracks metadata for the flutter migrate command
13 | migration:
14 | platforms:
15 | - platform: root
16 | create_revision: b0850beeb25f6d5b10426284f506557f66181b36
17 | base_revision: b0850beeb25f6d5b10426284f506557f66181b36
18 | - platform: android
19 | create_revision: b0850beeb25f6d5b10426284f506557f66181b36
20 | base_revision: b0850beeb25f6d5b10426284f506557f66181b36
21 | - platform: ios
22 | create_revision: b0850beeb25f6d5b10426284f506557f66181b36
23 | base_revision: b0850beeb25f6d5b10426284f506557f66181b36
24 | - platform: linux
25 | create_revision: b0850beeb25f6d5b10426284f506557f66181b36
26 | base_revision: b0850beeb25f6d5b10426284f506557f66181b36
27 | - platform: macos
28 | create_revision: b0850beeb25f6d5b10426284f506557f66181b36
29 | base_revision: b0850beeb25f6d5b10426284f506557f66181b36
30 | - platform: web
31 | create_revision: b0850beeb25f6d5b10426284f506557f66181b36
32 | base_revision: b0850beeb25f6d5b10426284f506557f66181b36
33 | - platform: windows
34 | create_revision: b0850beeb25f6d5b10426284f506557f66181b36
35 | base_revision: b0850beeb25f6d5b10426284f506557f66181b36
36 |
37 | # User provided section
38 |
39 | # List of Local paths (relative to this file) that should be
40 | # ignored by the migrate tool.
41 | #
42 | # Files that are not part of the templates will be ignored by default.
43 | unmanaged_files:
44 | - 'lib/main.dart'
45 | - 'ios/Runner.xcodeproj/project.pbxproj'
46 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Tutorial Clean Architecture
2 |
3 | A Flutter project demonstrating the implementation of Clean Architecture principles.
4 |
5 | ## Getting Started
6 |
7 | This project serves as an example project for building scalable and maintainable Flutter applications using Clean Architecture by Kuldii Project.
8 |
9 | ## Table of Contents
10 |
11 | - [Introduction](#introduction)
12 | - [Project Structure](#project-structure)
13 | - [Setup](#setup)
14 | - [Dependencies](#dependencies)
15 |
16 | ## Introduction
17 |
18 | Clean Architecture, popularized by Robert C. Martin (Uncle Bob), aims to create systems that are:
19 | - Independent of Frameworks
20 | - Testable
21 | - Independent of UI
22 | - Independent of Database
23 | - Independent of any external agency
24 |
25 | This project integrates Hive for local storage, ensuring that our data layer remains fast and efficient.
26 |
27 | ## Project Structure
28 |
29 | ```
30 | lib/
31 | ├── core/
32 | │ ├── error/
33 | │ └── routes/
34 | ├── features/
35 | │ ├── feature_name/
36 | │ │ ├── data/
37 | │ │ ├── domain/
38 | │ │ └── presentation/
39 | ├── injection.dart
40 | ├── observer.dart
41 | └── main.dart
42 | ```
43 |
44 | ## Setup
45 |
46 | 1. **Clone the repository:**
47 |
48 | ```bash
49 | git clone https://github.com/kuldii/tutorial_clean_architecture.git
50 | cd tutorial_clean_architecture
51 | ```
52 |
53 | 2. **Install dependencies:**
54 |
55 | ```bash
56 | flutter clean
57 | flutter pub upgrade --major-versions
58 | flutter pub get
59 | ```
60 |
61 | 3. **Generate some missing part:**
62 |
63 | ```bash
64 | dart run build_runner build --delete-conflicting-outputs
65 | ```
66 |
67 | 4. **Run the application:**
68 |
69 | ```bash
70 | flutter run
71 | ```
72 |
73 | ## Dependencies
74 |
75 | - [Bloc](https://pub.dev/packages/bloc)
76 | - [Hive](https://pub.dev/packages/hive)
77 | - [HTTP](https://pub.dev/packages/http)
78 | - [INTL](https://pub.dev/packages/intl)
79 | - [Dartz](https://pub.dev/packages/dartz)
80 | - [Get It](https://pub.dev/packages/get_it)
81 | - [Mockito](https://pub.dev/packages/mockito)
82 | - [Go Router](https://pub.dev/packages/go_router)
83 | - [Equatable](https://pub.dev/packages/equatable)
84 | - [Path Provider](https://pub.dev/packages/path_provider)
85 | - [Connectivity Plus](https://pub.dev/packages/connectivity_plus)
86 |
87 | For more information on Flutter, visit the [official documentation](https://docs.flutter.dev/). If you're new to Flutter, consider starting with the [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) or explore the [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook).
--------------------------------------------------------------------------------
/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | # This file configures the analyzer, which statically analyzes Dart code to
2 | # check for errors, warnings, and lints.
3 | #
4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6 | # invoked from the command line by running `flutter analyze`.
7 |
8 | # The following line activates a set of recommended lints for Flutter apps,
9 | # packages, and plugins designed to encourage good coding practices.
10 | include: package:flutter_lints/flutter.yaml
11 |
12 | linter:
13 | # The lint rules applied to this project can be customized in the
14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml`
15 | # included above or to enable additional rules. A list of all available lints
16 | # and their documentation is published at https://dart.dev/lints.
17 | #
18 | # Instead of disabling a lint rule for the entire project in the
19 | # section below, it can also be suppressed for a single line of code
20 | # or a specific dart file by using the `// ignore: name_of_lint` and
21 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file
22 | # producing the lint.
23 | rules:
24 | # avoid_print: false # Uncomment to disable the `avoid_print` rule
25 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
26 |
27 | # Additional information about this file can be found at
28 | # https://dart.dev/guides/language/analysis-options
29 |
--------------------------------------------------------------------------------
/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 | plugins {
2 | id "com.android.application"
3 | id "kotlin-android"
4 | // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
5 | id "dev.flutter.flutter-gradle-plugin"
6 | }
7 |
8 | def localProperties = new Properties()
9 | def localPropertiesFile = rootProject.file("local.properties")
10 | if (localPropertiesFile.exists()) {
11 | localPropertiesFile.withReader("UTF-8") { reader ->
12 | localProperties.load(reader)
13 | }
14 | }
15 |
16 | def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
17 | if (flutterVersionCode == null) {
18 | flutterVersionCode = "1"
19 | }
20 |
21 | def flutterVersionName = localProperties.getProperty("flutter.versionName")
22 | if (flutterVersionName == null) {
23 | flutterVersionName = "1.0"
24 | }
25 |
26 | android {
27 | namespace = "com.kuldiiproject.tutorial_clean_architecture"
28 | compileSdk = flutter.compileSdkVersion
29 | ndkVersion = flutter.ndkVersion
30 |
31 | compileOptions {
32 | sourceCompatibility = JavaVersion.VERSION_1_8
33 | targetCompatibility = JavaVersion.VERSION_1_8
34 | }
35 |
36 | defaultConfig {
37 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
38 | applicationId = "com.kuldiiproject.tutorial_clean_architecture"
39 | // You can update the following values to match your application needs.
40 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
41 | minSdk = flutter.minSdkVersion
42 | targetSdk = flutter.targetSdkVersion
43 | versionCode = flutterVersionCode.toInteger()
44 | versionName = flutterVersionName
45 | }
46 |
47 | buildTypes {
48 | release {
49 | // TODO: Add your own signing config for the release build.
50 | // Signing with the debug keys for now, so `flutter run --release` works.
51 | signingConfig = signingConfigs.debug
52 | }
53 | }
54 | }
55 |
56 | flutter {
57 | source = "../.."
58 | }
59 |
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
15 |
19 |
23 |
24 |
25 |
26 |
27 |
28 |
30 |
33 |
34 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/kuldiiproject/tutorial_clean_architecture/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.kuldiiproject.tutorial_clean_architecture
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity()
6 |
--------------------------------------------------------------------------------
/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/kuldii/tutorial_clean_architecture/978ed2c28dc5b1d5dc814059486f11c5ba4e864e/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kuldii/tutorial_clean_architecture/978ed2c28dc5b1d5dc814059486f11c5ba4e864e/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kuldii/tutorial_clean_architecture/978ed2c28dc5b1d5dc814059486f11c5ba4e864e/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kuldii/tutorial_clean_architecture/978ed2c28dc5b1d5dc814059486f11c5ba4e864e/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kuldii/tutorial_clean_architecture/978ed2c28dc5b1d5dc814059486f11c5ba4e864e/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/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | allprojects {
2 | repositories {
3 | google()
4 | mavenCentral()
5 | }
6 | }
7 |
8 | rootProject.buildDir = "../build"
9 | subprojects {
10 | project.buildDir = "${rootProject.buildDir}/${project.name}"
11 | }
12 | subprojects {
13 | project.evaluationDependsOn(":app")
14 | }
15 |
16 | tasks.register("clean", Delete) {
17 | delete rootProject.buildDir
18 | }
19 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx4G -XX:+HeapDumpOnOutOfMemoryError
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
6 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | def flutterSdkPath = {
3 | def properties = new Properties()
4 | file("local.properties").withInputStream { properties.load(it) }
5 | def flutterSdkPath = properties.getProperty("flutter.sdk")
6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7 | return flutterSdkPath
8 | }()
9 |
10 | includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
11 |
12 | repositories {
13 | google()
14 | mavenCentral()
15 | gradlePluginPortal()
16 | }
17 | }
18 |
19 | plugins {
20 | id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21 | id "com.android.application" version "7.3.0" apply false
22 | id "org.jetbrains.kotlin.android" version "1.7.10" apply false
23 | }
24 |
25 | include ":app"
26 |
--------------------------------------------------------------------------------
/ios/.gitignore:
--------------------------------------------------------------------------------
1 | **/dgph
2 | *.mode1v3
3 | *.mode2v3
4 | *.moved-aside
5 | *.pbxuser
6 | *.perspectivev3
7 | **/*sync/
8 | .sconsign.dblite
9 | .tags*
10 | **/.vagrant/
11 | **/DerivedData/
12 | Icon?
13 | **/Pods/
14 | **/.symlinks/
15 | profile
16 | xcuserdata
17 | **/.generated/
18 | Flutter/App.framework
19 | Flutter/Flutter.framework
20 | Flutter/Flutter.podspec
21 | Flutter/Generated.xcconfig
22 | Flutter/ephemeral/
23 | Flutter/app.flx
24 | Flutter/app.zip
25 | Flutter/flutter_assets/
26 | Flutter/flutter_export_environment.sh
27 | ServiceDefinitions.json
28 | Runner/GeneratedPluginRegistrant.*
29 |
30 | # Exceptions to above rules.
31 | !default.mode1v3
32 | !default.mode2v3
33 | !default.pbxuser
34 | !default.perspectivev3
35 |
--------------------------------------------------------------------------------
/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 12.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | # platform :ios, '12.0'
3 |
4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6 |
7 | project 'Runner', {
8 | 'Debug' => :debug,
9 | 'Profile' => :release,
10 | 'Release' => :release,
11 | }
12 |
13 | def flutter_root
14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15 | unless File.exist?(generated_xcode_build_settings_path)
16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17 | end
18 |
19 | File.foreach(generated_xcode_build_settings_path) do |line|
20 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
21 | return matches[1].strip if matches
22 | end
23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24 | end
25 |
26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27 |
28 | flutter_ios_podfile_setup
29 |
30 | target 'Runner' do
31 | use_frameworks!
32 | use_modular_headers!
33 |
34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35 | target 'RunnerTests' do
36 | inherit! :search_paths
37 | end
38 | end
39 |
40 | post_install do |installer|
41 | installer.pods_project.targets.each do |target|
42 | flutter_additional_ios_build_settings(target)
43 | end
44 | end
45 |
--------------------------------------------------------------------------------
/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - connectivity_plus (0.0.1):
3 | - Flutter
4 | - FlutterMacOS
5 | - Flutter (1.0.0)
6 | - path_provider_foundation (0.0.1):
7 | - Flutter
8 | - FlutterMacOS
9 |
10 | DEPENDENCIES:
11 | - connectivity_plus (from `.symlinks/plugins/connectivity_plus/darwin`)
12 | - Flutter (from `Flutter`)
13 | - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
14 |
15 | EXTERNAL SOURCES:
16 | connectivity_plus:
17 | :path: ".symlinks/plugins/connectivity_plus/darwin"
18 | Flutter:
19 | :path: Flutter
20 | path_provider_foundation:
21 | :path: ".symlinks/plugins/path_provider_foundation/darwin"
22 |
23 | SPEC CHECKSUMS:
24 | connectivity_plus: ddd7f30999e1faaef5967c23d5b6d503d10434db
25 | Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
26 | path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
27 |
28 | PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796
29 |
30 | COCOAPODS: 1.15.2
31 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
37 |
38 |
39 |
40 |
43 |
49 |
50 |
51 |
52 |
53 |
63 |
65 |
71 |
72 |
73 |
74 |
80 |
82 |
88 |
89 |
90 |
91 |
93 |
94 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import Flutter
2 | import UIKit
3 |
4 | @main
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/kuldii/tutorial_clean_architecture/978ed2c28dc5b1d5dc814059486f11c5ba4e864e/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/kuldii/tutorial_clean_architecture/978ed2c28dc5b1d5dc814059486f11c5ba4e864e/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/kuldii/tutorial_clean_architecture/978ed2c28dc5b1d5dc814059486f11c5ba4e864e/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/kuldii/tutorial_clean_architecture/978ed2c28dc5b1d5dc814059486f11c5ba4e864e/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/kuldii/tutorial_clean_architecture/978ed2c28dc5b1d5dc814059486f11c5ba4e864e/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/kuldii/tutorial_clean_architecture/978ed2c28dc5b1d5dc814059486f11c5ba4e864e/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/kuldii/tutorial_clean_architecture/978ed2c28dc5b1d5dc814059486f11c5ba4e864e/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/kuldii/tutorial_clean_architecture/978ed2c28dc5b1d5dc814059486f11c5ba4e864e/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/kuldii/tutorial_clean_architecture/978ed2c28dc5b1d5dc814059486f11c5ba4e864e/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/kuldii/tutorial_clean_architecture/978ed2c28dc5b1d5dc814059486f11c5ba4e864e/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/kuldii/tutorial_clean_architecture/978ed2c28dc5b1d5dc814059486f11c5ba4e864e/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/kuldii/tutorial_clean_architecture/978ed2c28dc5b1d5dc814059486f11c5ba4e864e/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/kuldii/tutorial_clean_architecture/978ed2c28dc5b1d5dc814059486f11c5ba4e864e/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/kuldii/tutorial_clean_architecture/978ed2c28dc5b1d5dc814059486f11c5ba4e864e/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/kuldii/tutorial_clean_architecture/978ed2c28dc5b1d5dc814059486f11c5ba4e864e/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/kuldii/tutorial_clean_architecture/978ed2c28dc5b1d5dc814059486f11c5ba4e864e/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kuldii/tutorial_clean_architecture/978ed2c28dc5b1d5dc814059486f11c5ba4e864e/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kuldii/tutorial_clean_architecture/978ed2c28dc5b1d5dc814059486f11c5ba4e864e/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 | CFBundleDisplayName
8 | Tutorial Clean Architecture
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | tutorial_clean_architecture
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | $(FLUTTER_BUILD_NUMBER)
25 | LSRequiresIPhoneOS
26 |
27 | UILaunchStoryboardName
28 | LaunchScreen
29 | UIMainStoryboardFile
30 | Main
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 | CADisableMinimumFrameDurationOnPhone
45 |
46 | UIApplicationSupportsIndirectInputEvents
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/ios/RunnerTests/RunnerTests.swift:
--------------------------------------------------------------------------------
1 | import Flutter
2 | import UIKit
3 | import XCTest
4 |
5 | class RunnerTests: XCTestCase {
6 |
7 | func testExample() {
8 | // If you add code to the Runner application, consider adding tests here.
9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest.
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/lib/core/error/exception.dart:
--------------------------------------------------------------------------------
1 | class GeneralException implements Exception {
2 | final String message;
3 |
4 | const GeneralException({required this.message});
5 | }
6 |
7 | class ServerException implements Exception {
8 | final String message;
9 |
10 | const ServerException({required this.message});
11 | }
12 |
13 | class StatusCodeException implements Exception {
14 | final String message;
15 |
16 | const StatusCodeException({required this.message});
17 | }
18 |
19 | class EmptyException implements Exception {
20 | final String message;
21 |
22 | const EmptyException({required this.message});
23 | }
24 |
--------------------------------------------------------------------------------
/lib/core/error/failure.dart:
--------------------------------------------------------------------------------
1 | class Failure {}
2 |
--------------------------------------------------------------------------------
/lib/core/routes/my_router.dart:
--------------------------------------------------------------------------------
1 | import 'package:go_router/go_router.dart';
2 |
3 | import '../../features/profile/presentation/pages/all_users_page.dart';
4 | import '../../features/profile/presentation/pages/detail_user_page.dart';
5 |
6 | class MyRouter {
7 | get router => GoRouter(
8 | initialLocation: "/",
9 | routes: [
10 | GoRoute(
11 | path: "/",
12 | name: "all_users",
13 | pageBuilder: (context, state) => const NoTransitionPage(
14 | child: AllUsersPage(),
15 | ),
16 | // sub routes
17 | routes: [
18 | GoRoute(
19 | path: "detail-user",
20 | name: "detail_user",
21 | pageBuilder: (context, state) => NoTransitionPage(
22 | child: DetailUserPage(
23 | state.extra as int,
24 | ),
25 | ),
26 | ),
27 | ],
28 | ),
29 | ],
30 | );
31 | }
32 |
--------------------------------------------------------------------------------
/lib/features/profile/data/datasources/local_datasource.dart:
--------------------------------------------------------------------------------
1 | import 'package:hive/hive.dart';
2 |
3 | import '../models/profile_model.dart';
4 |
5 | abstract class ProfileLocalDataSource {
6 | Future> getAllUser(int page);
7 | Future getUser(int id);
8 | }
9 |
10 | class ProfileLocalDataSourceImplementation extends ProfileLocalDataSource {
11 | final Box box;
12 |
13 | ProfileLocalDataSourceImplementation({required this.box});
14 |
15 | @override
16 | Future> getAllUser(int page) async {
17 | return box.get("getAllUser");
18 | }
19 |
20 | @override
21 | Future getUser(int id) async {
22 | return box.get("getUser");
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/lib/features/profile/data/datasources/remote_datasource.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 |
3 | import 'package:http/http.dart' as http;
4 |
5 | import '../../../../core/error/exception.dart';
6 | import '../models/profile_model.dart';
7 |
8 | // REAL CLASS
9 | abstract class ProfileRemoteDataSource {
10 | Future> getAllUser(int page);
11 | Future getUser(int id);
12 | }
13 |
14 | class ProfileRemoteDataSourceImplementation extends ProfileRemoteDataSource {
15 | final http.Client client;
16 |
17 | // REAL CLASS / FAKE CLASS
18 | ProfileRemoteDataSourceImplementation({required this.client});
19 |
20 | @override
21 | Future> getAllUser(int page) async {
22 | Uri url = Uri.parse("https://reqres.in/api/users?page=$page");
23 | var response = await client.get(url);
24 |
25 | if (response.statusCode == 200) {
26 | Map dataBody = jsonDecode(response.body);
27 | List data = dataBody["data"];
28 | if (data.isEmpty) throw const EmptyException(message: "Error Empty Data");
29 | return ProfileModel.fromJsonList(data);
30 | } else if (response.statusCode == 404) {
31 | throw const StatusCodeException(message: "Data not found - Error 404");
32 | } else {
33 | throw const GeneralException(message: "Cannot get data");
34 | }
35 | }
36 |
37 | @override
38 | Future getUser(int id) async {
39 | Uri url = Uri.parse("https://reqres.in/api/users/$id");
40 | var response = await client.get(url);
41 |
42 | if (response.statusCode == 200) {
43 | Map dataBody = jsonDecode(response.body);
44 | Map data = dataBody["data"];
45 | return ProfileModel.fromJson(data);
46 | } else if (response.statusCode == 404) {
47 | throw const EmptyException(message: "Data not found - Error 404");
48 | } else {
49 | throw const GeneralException(message: "Cannot get data");
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/lib/features/profile/data/models/profile_model.dart:
--------------------------------------------------------------------------------
1 | import 'package:hive/hive.dart';
2 |
3 | import '../../domain/entities/profile.dart';
4 |
5 | part 'profile_model.g.dart'; // ini adalah file generated by hive generator <- ProfileModelAdapter
6 |
7 | @HiveType(typeId: 1)
8 | class ProfileModel extends Profile {
9 | @HiveField(4)
10 | final String firstName;
11 | @HiveField(5)
12 | final String lastName;
13 | @HiveField(6)
14 | final String avatar;
15 |
16 | const ProfileModel({
17 | required super.id,
18 | required super.email,
19 | required this.firstName,
20 | required this.lastName,
21 | required this.avatar,
22 | }) : super(
23 | fullName: "$firstName $lastName",
24 | profileImageUrl: avatar,
25 | );
26 |
27 | factory ProfileModel.fromJson(Map data) {
28 | return ProfileModel(
29 | id: data["id"],
30 | email: data["email"],
31 | firstName: data["first_name"],
32 | lastName: data["last_name"],
33 | avatar: data["avatar"],
34 | );
35 | }
36 |
37 | Map toJson() {
38 | return {
39 | "id": id,
40 | "email": email,
41 | "first_name": firstName,
42 | "last_name": lastName,
43 | "avatar": avatar,
44 | };
45 | }
46 |
47 | static List fromJsonList(List data) {
48 | if (data.isEmpty) return [];
49 | return data.map((singleDataProfile) => ProfileModel.fromJson(singleDataProfile)).toList();
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/lib/features/profile/data/models/profile_model.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'profile_model.dart';
4 |
5 | // **************************************************************************
6 | // TypeAdapterGenerator
7 | // **************************************************************************
8 |
9 | class ProfileModelAdapter extends TypeAdapter {
10 | @override
11 | final int typeId = 1;
12 |
13 | @override
14 | ProfileModel read(BinaryReader reader) {
15 | final numOfFields = reader.readByte();
16 | final fields = {
17 | for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
18 | };
19 | return ProfileModel(
20 | id: fields[0] as int,
21 | email: fields[1] as String,
22 | firstName: fields[4] as String,
23 | lastName: fields[5] as String,
24 | avatar: fields[6] as String,
25 | );
26 | }
27 |
28 | @override
29 | void write(BinaryWriter writer, ProfileModel obj) {
30 | writer
31 | ..writeByte(7)
32 | ..writeByte(4)
33 | ..write(obj.firstName)
34 | ..writeByte(5)
35 | ..write(obj.lastName)
36 | ..writeByte(6)
37 | ..write(obj.avatar)
38 | ..writeByte(0)
39 | ..write(obj.id)
40 | ..writeByte(1)
41 | ..write(obj.email)
42 | ..writeByte(2)
43 | ..write(obj.fullName)
44 | ..writeByte(3)
45 | ..write(obj.profileImageUrl);
46 | }
47 |
48 | @override
49 | int get hashCode => typeId.hashCode;
50 |
51 | @override
52 | bool operator ==(Object other) =>
53 | identical(this, other) ||
54 | other is ProfileModelAdapter &&
55 | runtimeType == other.runtimeType &&
56 | typeId == other.typeId;
57 | }
58 |
--------------------------------------------------------------------------------
/lib/features/profile/data/repositories/profile_repository_implementation.dart:
--------------------------------------------------------------------------------
1 | import 'package:connectivity_plus/connectivity_plus.dart';
2 | import 'package:dartz/dartz.dart';
3 | import 'package:hive/hive.dart';
4 |
5 | import '../../../../core/error/failure.dart';
6 | import '../../domain/entities/profile.dart';
7 | import '../../domain/repositories/profile_repository.dart';
8 | import '../datasources/local_datasource.dart';
9 | import '../datasources/remote_datasource.dart';
10 | import '../models/profile_model.dart';
11 |
12 | class ProfileRepositoryImplementation extends ProfileRepository {
13 | final ProfileRemoteDataSource profileRemoteDataSource;
14 | final ProfileLocalDataSource profileLocalDataSource;
15 | final Box box;
16 |
17 | ProfileRepositoryImplementation({
18 | required this.profileLocalDataSource,
19 | required this.profileRemoteDataSource,
20 | required this.box,
21 | });
22 |
23 | @override
24 | Future>> getAllUser(int page) async {
25 | try {
26 | // Check internet
27 | final List connectivityResult = await (Connectivity().checkConnectivity());
28 |
29 | if (connectivityResult.contains(ConnectivityResult.none)) {
30 | // No available network
31 | // Ngambil dari Local Datasource
32 | List hasil = await profileLocalDataSource.getAllUser(page);
33 | return Right(hasil);
34 | } else {
35 | // Available network
36 | // Ngambil dari Remote Datasource
37 | List hasil = await profileRemoteDataSource.getAllUser(page);
38 | // Put last data profile ke Box Local
39 | box.put("getAllUser", hasil);
40 | return Right(hasil);
41 | }
42 | } catch (e) {
43 | return Left(Failure());
44 | }
45 | }
46 |
47 | @override
48 | Future> getUser(int id) async {
49 | try {
50 | // Check internet
51 | final List connectivityResult = await (Connectivity().checkConnectivity());
52 |
53 | if (connectivityResult.contains(ConnectivityResult.none)) {
54 | // No available network
55 | // Ngambil dari Local Datasource
56 | ProfileModel hasil = await profileLocalDataSource.getUser(id);
57 | return Right(hasil);
58 | } else {
59 | // Available network
60 | // Ngambil dari Remote Datasource
61 | ProfileModel hasil = await profileRemoteDataSource.getUser(id);
62 | // Put last data profile ke Box Local
63 | box.put("getUser", hasil);
64 | return Right(hasil);
65 | }
66 | } catch (e) {
67 | return Left(Failure());
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/lib/features/profile/domain/entities/profile.dart:
--------------------------------------------------------------------------------
1 | import 'package:equatable/equatable.dart';
2 | import 'package:hive/hive.dart';
3 |
4 | @HiveType(typeId: 0)
5 | class Profile extends Equatable {
6 | @HiveField(0)
7 | final int id;
8 | @HiveField(1)
9 | final String email;
10 | @HiveField(2)
11 | final String fullName;
12 | @HiveField(3)
13 | final String profileImageUrl;
14 |
15 | const Profile({
16 | required this.id,
17 | required this.email,
18 | required this.fullName,
19 | required this.profileImageUrl,
20 | });
21 |
22 | @override
23 | List