├── ios ├── Runner │ ├── Runner-Bridging-Header.h │ ├── Assets.xcassets │ │ ├── LaunchImage.imageset │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ ├── README.md │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ └── Contents.json │ ├── AppDelegate.swift │ ├── Base.lproj │ │ ├── Main.storyboard │ │ └── LaunchScreen.storyboard │ └── Info.plist ├── Flutter │ ├── Debug.xcconfig │ ├── Release.xcconfig │ └── AppFrameworkInfo.plist ├── Runner.xcodeproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── WorkspaceSettings.xcsettings │ │ └── IDEWorkspaceChecks.plist ├── .gitignore ├── Podfile.lock └── Podfile ├── lib ├── app │ ├── constants │ │ ├── app_assets.dart │ │ ├── app_urls.dart │ │ ├── app_constants.dart │ │ ├── mock_paths.dart │ │ └── app_colors.dart │ ├── config │ │ ├── app_theme.dart │ │ ├── environment_config.dart │ │ └── app_fonts.dart │ ├── utils │ │ └── string_validators.dart │ ├── extensions │ │ └── context_extensions.dart │ ├── di │ │ ├── modules │ │ │ ├── remote_modules.dart │ │ │ ├── repository_modules.dart │ │ │ ├── ui_modules.dart │ │ │ ├── local_modules.dart │ │ │ └── api_modules.dart │ │ ├── top_bloc_provider.dart │ │ └── di.dart │ ├── routes │ │ ├── app_paths.dart │ │ └── app_routes.dart │ ├── l10n │ │ ├── app_en.arb │ │ └── app_es.arb │ └── types │ │ ├── auth_status.dart │ │ ├── result.dart │ │ ├── screen_status.dart │ │ ├── repository_error.dart │ │ ├── errors │ │ ├── network_error_utils.dart │ │ └── network_error.dart │ │ ├── result.freezed.dart │ │ └── auth_status.freezed.dart ├── data │ ├── repositories │ │ ├── data_source_contracts │ │ │ ├── local │ │ │ │ └── app_local_datasource_contract.dart │ │ │ └── remote │ │ │ │ └── app_remote_data_source_contract.dart │ │ └── app_repository.dart │ ├── datasources │ │ ├── remote_data_source │ │ │ ├── api │ │ │ │ ├── app_api.dart │ │ │ │ ├── network │ │ │ │ │ ├── interceptors │ │ │ │ │ │ ├── mock_interceptor.dart │ │ │ │ │ │ └── curl_dio_interceptor.dart │ │ │ │ │ └── dio_http_client.dart │ │ │ │ └── app_api.g.dart │ │ │ └── app_remote_data_source.dart │ │ └── local_data_source │ │ │ └── app_local_datasource.dart │ └── models │ │ ├── example_remote_entity.dart │ │ ├── example_remote_entity.g.dart │ │ └── example_remote_entity.freezed.dart ├── domain │ ├── repository_contracts │ │ └── app_repository_contract.dart │ └── models │ │ ├── example_entity.dart │ │ ├── example_entity.g.dart │ │ └── example_entity.freezed.dart ├── presentation │ ├── top_blocs │ │ └── language_bloc │ │ │ ├── language_bloc_event.dart │ │ │ ├── language_bloc_state.dart │ │ │ ├── language_bloc.dart │ │ │ ├── language_bloc_state.freezed.dart │ │ │ └── language_bloc_event.freezed.dart │ ├── features │ │ ├── splash │ │ │ ├── splash_bloc │ │ │ │ ├── splash_event.dart │ │ │ │ ├── splash_state.dart │ │ │ │ ├── splash_bloc.dart │ │ │ │ ├── splash_event.freezed.dart │ │ │ │ └── splash_state.freezed.dart │ │ │ ├── splash_controller.dart │ │ │ └── splash_screen.dart │ │ ├── authentication │ │ │ ├── auth_bloc │ │ │ │ ├── auth_event.dart │ │ │ │ ├── auth_state.dart │ │ │ │ ├── auth_bloc.dart │ │ │ │ ├── auth_state.freezed.dart │ │ │ │ └── auth_event.freezed.dart │ │ │ ├── auth_controller.dart │ │ │ └── authentication_screen.dart │ │ └── home │ │ │ └── home_screen.dart │ └── widgets │ │ └── custom_circular_loader.dart └── main.dart ├── android ├── gradle.properties ├── app │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── drawable │ │ │ │ │ └── launch_background.xml │ │ │ │ ├── drawable-v21 │ │ │ │ │ └── launch_background.xml │ │ │ │ ├── values │ │ │ │ │ └── styles.xml │ │ │ │ └── values-night │ │ │ │ │ └── styles.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── clean_architecture_template │ │ │ │ │ └── MainActivity.kt │ │ │ └── AndroidManifest.xml │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ └── profile │ │ │ └── AndroidManifest.xml │ └── build.gradle ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── .gitignore ├── settings.gradle └── build.gradle ├── l10n.yaml ├── assets └── fonts │ ├── Merriweather-Black.ttf │ ├── Merriweather-Bold.ttf │ ├── Merriweather-Regular.ttf │ ├── NunitoSans_10pt-Bold.ttf │ └── NunitoSans_10pt-Regular.ttf ├── cleanBuild.sh ├── cleanIos.sh ├── .gitignore ├── test └── widget_test.dart ├── .metadata ├── analysis_options.yaml ├── pubspec.yaml └── README.md /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /lib/app/constants/app_assets.dart: -------------------------------------------------------------------------------- 1 | class AppAssets { 2 | AppAssets._(); 3 | } 4 | -------------------------------------------------------------------------------- /lib/app/config/app_theme.dart: -------------------------------------------------------------------------------- 1 | 2 | 3 | class AppTheme { 4 | AppTheme._(); 5 | 6 | } 7 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /lib/app/constants/app_urls.dart: -------------------------------------------------------------------------------- 1 | class AppUrls { 2 | static const String baseUrl = 'https://baseUrl.com/'; 3 | 4 | AppUrls._(); 5 | } 6 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /l10n.yaml: -------------------------------------------------------------------------------- 1 | arb-dir: lib/app/l10n 2 | template-arb-file: app_es.arb 3 | output-localization-file: app_localizations.dart 4 | nullable-getter: false -------------------------------------------------------------------------------- /lib/app/constants/app_constants.dart: -------------------------------------------------------------------------------- 1 | class AppConstants { 2 | static const String appName = 'Funciona'; 3 | 4 | AppConstants._(); 5 | } 6 | -------------------------------------------------------------------------------- /assets/fonts/Merriweather-Black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/assets/fonts/Merriweather-Black.ttf -------------------------------------------------------------------------------- /assets/fonts/Merriweather-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/assets/fonts/Merriweather-Bold.ttf -------------------------------------------------------------------------------- /assets/fonts/Merriweather-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/assets/fonts/Merriweather-Regular.ttf -------------------------------------------------------------------------------- /assets/fonts/NunitoSans_10pt-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/assets/fonts/NunitoSans_10pt-Bold.ttf -------------------------------------------------------------------------------- /assets/fonts/NunitoSans_10pt-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/assets/fonts/NunitoSans_10pt-Regular.ttf -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /lib/app/constants/mock_paths.dart: -------------------------------------------------------------------------------- 1 | class MocksPaths { 2 | static String error = 'mockError'; 3 | static String mockPathBaseAssets = 'assets/mock'; 4 | 5 | MocksPaths._(); 6 | } 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /lib/app/config/environment_config.dart: -------------------------------------------------------------------------------- 1 | class EnvironmentConfig { 2 | static const environment = String.fromEnvironment( 3 | 'ENVIRONMENT', 4 | defaultValue: 'prod', 5 | ); 6 | } 7 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /cleanBuild.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | flutter clean 3 | find . -name "*.g.dart" -delete 4 | find . -name "*.freezed.dart" -delete 5 | flutter pub get 6 | flutter pub run build_runner build --delete-conflicting-outputs 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /lib/app/utils/string_validators.dart: -------------------------------------------------------------------------------- 1 | class StringValidators { 2 | static bool emailValidator(String email) => RegExp( 3 | r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$', 4 | ).hasMatch(email); 5 | } 6 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antOnioOnio/custom_clean_architecture_template/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /lib/data/repositories/data_source_contracts/local/app_local_datasource_contract.dart: -------------------------------------------------------------------------------- 1 | abstract class AppLocalDataSourceContract { 2 | Future getValidToken(); 3 | 4 | Future setValidToken(bool value); 5 | } 6 | -------------------------------------------------------------------------------- /cleanIos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | flutter clean 3 | rm -Rf ios/Pods 4 | rm -Rf ios/.symlinks 5 | rm -Rf ios/Flutter/Flutter.framework 6 | rm -Rf ios/Flutter/Flutter.podspec 7 | flutter pub get 8 | cd ios 9 | pod install 10 | cd .. -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/clean_architecture_template/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.clean_architecture_template 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /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.4-all.zip 6 | -------------------------------------------------------------------------------- /lib/app/extensions/context_extensions.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_gen/gen_l10n/app_localizations.dart'; 3 | 4 | extension LocalizedBuildContext on BuildContext { 5 | AppLocalizations get localizations => AppLocalizations.of(this); 6 | } 7 | -------------------------------------------------------------------------------- /lib/data/repositories/data_source_contracts/remote/app_remote_data_source_contract.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_architecture_template/data/models/example_remote_entity.dart'; 2 | 3 | abstract class AppRemoteDataSourceContract { 4 | Future getExamples(); 5 | 6 | } 7 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /lib/app/di/modules/remote_modules.dart: -------------------------------------------------------------------------------- 1 | part of '../di.dart'; 2 | 3 | final remoteModulesDi = GetIt.instance; 4 | 5 | void _remoteModulesInit() { 6 | // Data sources 7 | remoteModulesDi.registerLazySingleton( 8 | () => AppRemoteDataSource(remoteModulesDi()), 9 | ); 10 | } 11 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /lib/app/di/modules/repository_modules.dart: -------------------------------------------------------------------------------- 1 | part of '../di.dart'; 2 | 3 | final repositoryModulesDi = GetIt.instance; 4 | 5 | void _repositoryModulesInit() { 6 | repositoryModulesDi.registerLazySingleton( 7 | () => AppRepository( 8 | repositoryModulesDi(), 9 | ), 10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/domain/repository_contracts/app_repository_contract.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_architecture_template/app/types/result.dart'; 2 | 3 | abstract class AppRepositoryContract { 4 | Future> getValidToken(); 5 | 6 | Future> setValidToken(bool value); 7 | 8 | Future> logIn(); 9 | 10 | Future> logOut(); 11 | } 12 | -------------------------------------------------------------------------------- /lib/app/routes/app_paths.dart: -------------------------------------------------------------------------------- 1 | class AppRoutePath { 2 | static String main = '/'; 3 | static String authController = '/authenticationController'; 4 | static String authenticationScreen = '$authController/authenticationScreen'; 5 | static String onBoardingScreen = '$authenticationScreen/onBoardingScreen'; 6 | static String homeScreen = '$authenticationScreen/homeScreen'; 7 | } 8 | -------------------------------------------------------------------------------- /lib/app/l10n/app_en.arb: -------------------------------------------------------------------------------- 1 | { 2 | "@@locale":"en", 3 | "home_screen_title" : "Home", 4 | "english_language_text" : "English", 5 | "spanish_language_text" : "Español", 6 | "log_in_text" : "login", 7 | "log_out_text" : "logout", 8 | "user_text": "user", 9 | "password_text": "password", 10 | "welcome_text" : "Welcome to your app" 11 | 12 | } 13 | 14 | -------------------------------------------------------------------------------- /lib/app/l10n/app_es.arb: -------------------------------------------------------------------------------- 1 | { 2 | "@@locale":"es", 3 | "home_screen_title": "Inicio", 4 | "english_language_text": "English", 5 | "spanish_language_text": "Español", 6 | "log_in_text": "Iniciar sesión", 7 | "log_out_text": "Cerrar sesión", 8 | "user_text": "Usuario", 9 | "password_text": "Contraseña", 10 | "welcome_text" : "Bienvenido a tu aplicación" 11 | } 12 | 13 | -------------------------------------------------------------------------------- /lib/presentation/top_blocs/language_bloc/language_bloc_event.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:freezed_annotation/freezed_annotation.dart'; 4 | 5 | part 'language_bloc_event.freezed.dart'; 6 | 7 | @freezed 8 | class LanguageBlocEvent with _$LanguageBlocEvent { 9 | const factory LanguageBlocEvent.changedLanguage(Locale locale) = 10 | _ChangedLanguage; 11 | } 12 | -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /lib/app/di/modules/ui_modules.dart: -------------------------------------------------------------------------------- 1 | part of '../di.dart'; 2 | 3 | final uiModulesDi = GetIt.instance; 4 | 5 | void _uiModulesInit() { 6 | uiModulesDi.registerFactory( 7 | () => LanguagesBloc(), 8 | ); 9 | uiModulesDi.registerFactory( 10 | () => SplashBloc(), 11 | ); 12 | 13 | uiModulesDi.registerFactory( 14 | () => AuthBloc(repositoryContract: uiModulesDi()), 15 | ); 16 | } 17 | -------------------------------------------------------------------------------- /lib/app/di/modules/local_modules.dart: -------------------------------------------------------------------------------- 1 | part of '../di.dart'; 2 | 3 | final localModulesDi = GetIt.instance; 4 | 5 | void _localModulesInit({required SharedPreferences instance}) { 6 | // Data sources 7 | localModulesDi.registerLazySingleton( 8 | () { 9 | return AppLocalDataSource( 10 | sharedPreferencesInstance: instance, 11 | ); 12 | }, 13 | ); 14 | } 15 | -------------------------------------------------------------------------------- /lib/data/datasources/remote_data_source/api/app_api.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:clean_architecture_template/data/models/example_remote_entity.dart'; 3 | import 'package:retrofit/http.dart'; 4 | 5 | part 'app_api.g.dart'; 6 | 7 | @RestApi() 8 | abstract class AppApi { 9 | factory AppApi(Dio dio, {String? baseUrl}) = _AppApi; 10 | 11 | @GET('/api/example') 12 | Future getMyExamples(); 13 | 14 | 15 | } 16 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/presentation/features/splash/splash_bloc/splash_event.dart: -------------------------------------------------------------------------------- 1 | import 'package:freezed_annotation/freezed_annotation.dart'; 2 | 3 | part 'splash_event.freezed.dart'; 4 | 5 | /// The `SplashEvent` class represents the events that can occur during the splash screen. 6 | @freezed 7 | class SplashEvent with _$SplashEvent { 8 | /// Creates an instance of `SplashEvent` that will cause the splash screen to be dismissed after a certain amount of time. 9 | const factory SplashEvent.unSplashInNMilliseconds(int milliseconds) = 10 | _UnSplashInNMilliseconds; 11 | } 12 | -------------------------------------------------------------------------------- /lib/app/routes/app_routes.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_architecture_template/presentation/features/authentication/auth_controller.dart'; 2 | import 'package:clean_architecture_template/presentation/features/splash/splash_controller.dart'; 3 | import 'package:go_router/go_router.dart'; 4 | 5 | List appRoutes = [ 6 | GoRoute( 7 | path: '/', 8 | builder: (context, state) => const SplashController(), 9 | routes: [ 10 | GoRoute( 11 | path: 'authenticationController', 12 | builder: (context, state) => const AuthController(), 13 | ), 14 | ], 15 | ), 16 | ]; 17 | -------------------------------------------------------------------------------- /lib/presentation/top_blocs/language_bloc/language_bloc_state.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:freezed_annotation/freezed_annotation.dart'; 4 | 5 | part 'language_bloc_state.freezed.dart'; 6 | 7 | @freezed 8 | class LanguageBlocState with _$LanguageBlocState { 9 | const factory LanguageBlocState({ 10 | required Locale locale, 11 | }) = _LanguageBlocState; 12 | } 13 | 14 | extension LanguageBlocStateExtension on LanguageBlocState { 15 | bool isSelected(Locale localePassed) => localePassed == locale; 16 | 17 | String getLocaleUpper() => locale.languageCode.toUpperCase(); 18 | } 19 | -------------------------------------------------------------------------------- /lib/presentation/widgets/custom_circular_loader.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class CustomCircularLoader extends StatelessWidget { 4 | const CustomCircularLoader({Key? key}) : super(key: key); 5 | 6 | @override 7 | Widget build(BuildContext context) { 8 | return const Center( 9 | child: SizedBox( 10 | height: 20, 11 | width: 20, 12 | child: CircularProgressIndicator( 13 | color: Color.fromRGBO(23, 69, 232, 1), 14 | backgroundColor: Color.fromRGBO(0, 122, 255, 1), 15 | strokeWidth: 2, 16 | ), 17 | ), 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /lib/presentation/features/authentication/auth_bloc/auth_event.dart: -------------------------------------------------------------------------------- 1 | import 'package:freezed_annotation/freezed_annotation.dart'; 2 | 3 | part 'auth_event.freezed.dart'; 4 | 5 | /// The `AuthEvent` class is a sealed class that represents the various types of events that can occur during authentication. 6 | @freezed 7 | class AuthEvent with _$AuthEvent { 8 | const factory AuthEvent.signInEvent() = _SignInEvent; 9 | 10 | /// This factory method represents the event where the user has signed out. 11 | const factory AuthEvent.signOutEvent() = _SignOutEvent; 12 | 13 | const factory AuthEvent.checkForValidToken() = _CheckForValidToken; 14 | } 15 | -------------------------------------------------------------------------------- /lib/data/datasources/remote_data_source/app_remote_data_source.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_architecture_template/data/datasources/remote_data_source/api/app_api.dart'; 2 | import 'package:clean_architecture_template/data/models/example_remote_entity.dart'; 3 | import 'package:clean_architecture_template/data/repositories/data_source_contracts/remote/app_remote_data_source_contract.dart'; 4 | 5 | class AppRemoteDataSource implements AppRemoteDataSourceContract{ 6 | final AppApi _api; 7 | 8 | AppRemoteDataSource(this._api); 9 | @override 10 | Future getExamples() async{ 11 | final response = await _api.getMyExamples(); 12 | 13 | return response; 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /lib/data/models/example_remote_entity.dart: -------------------------------------------------------------------------------- 1 | import 'package:freezed_annotation/freezed_annotation.dart'; 2 | 3 | part 'example_remote_entity.freezed.dart'; 4 | 5 | part 'example_remote_entity.g.dart'; 6 | 7 | @freezed 8 | class ExampleRemoteEntity with _$ExampleRemoteEntity { 9 | const factory ExampleRemoteEntity({ 10 | required int id, 11 | required int pk, 12 | required String status, 13 | required String title, 14 | @JsonKey(name: 'primary_description') required String primaryDescription, 15 | required String description, 16 | }) = _ExampleRemoteEntity; 17 | 18 | factory ExampleRemoteEntity.fromJson(Map json) => 19 | _$ExampleRemoteEntityFromJson(json); 20 | } 21 | -------------------------------------------------------------------------------- /lib/presentation/features/splash/splash_bloc/splash_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:freezed_annotation/freezed_annotation.dart'; 2 | 3 | part 'splash_state.freezed.dart'; 4 | 5 | /// The `SplashState` class represents the current state of the splash screen. 6 | @freezed 7 | class SplashState with _$SplashState { 8 | /// Creates an instance of `SplashState` representing an initial state. 9 | const factory SplashState.initial() = _Initial; 10 | 11 | /// Creates an instance of `SplashState` representing a splashed state. 12 | const factory SplashState.splashed() = _Splashed; 13 | } 14 | 15 | extension SplashStateExtension on SplashState { 16 | bool isSplashed() => when(initial: () => false, splashed: () => true); 17 | } 18 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/app/types/auth_status.dart: -------------------------------------------------------------------------------- 1 | import 'package:freezed_annotation/freezed_annotation.dart'; 2 | 3 | part 'auth_status.freezed.dart'; 4 | 5 | @freezed 6 | class UserAuthStatus with _$UserAuthStatus { 7 | const factory UserAuthStatus.unidentified() = _Unidentified; 8 | 9 | const factory UserAuthStatus.loggedIn() = _LoggedIn; 10 | 11 | const factory UserAuthStatus.error() = _Error; 12 | } 13 | 14 | extension UserLoadingStatusExtension on UserAuthStatus { 15 | bool isUnidentified() => 16 | maybeWhen(orElse: () => false, unidentified: () => true); 17 | 18 | bool isLoggedIn() => maybeWhen(orElse: () => false, loggedIn: () => true); 19 | 20 | bool isError() => maybeWhen(orElse: () => false, error: () => true); 21 | } 22 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.6.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.1.2' 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 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /lib/app/di/modules/api_modules.dart: -------------------------------------------------------------------------------- 1 | part of '../di.dart'; 2 | 3 | final apiModulesDi = GetIt.instance; 4 | 5 | void _apiModulesInit() { 6 | apiModulesDi.registerLazySingleton(() { 7 | var dioClient = DioClient(); 8 | 9 | dioClient.addInterceptors([ 10 | ...EnvironmentConfig.environment == 'dev' 11 | ? [CurlLoggerDioInterceptor(printOnSuccess: true)] 12 | : [], 13 | ...EnvironmentConfig.environment == 'mock' ? [MockInterceptor()] : [], 14 | ]); 15 | dioClient.addBadCertificateCallBack(); 16 | dioClient.addBadCertificateCallBack(); 17 | 18 | return dioClient.getDio(); 19 | }); 20 | 21 | apiModulesDi.registerLazySingleton( 22 | () => AppApi( 23 | apiModulesDi(), 24 | baseUrl: AppUrls.baseUrl, 25 | ), 26 | ); 27 | } 28 | -------------------------------------------------------------------------------- /lib/app/types/result.dart: -------------------------------------------------------------------------------- 1 | // Part file that contains the generated code for the 'Result' class. 2 | import 'package:freezed_annotation/freezed_annotation.dart'; 3 | import 'package:clean_architecture_template/app/types/repository_error.dart'; 4 | 5 | part 'result.freezed.dart'; 6 | 7 | // Annotating the 'Result' class with '@freezed' to generate the necessary boilerplate code. 8 | @freezed 9 | class Result with _$Result { 10 | // Factory constructor for representing a failure. 11 | // Takes an instance of 'RepositoryError' as a required parameter. 12 | const factory Result.failure({required RepositoryError error}) = Failure; 13 | 14 | // Factory constructor for representing a success. 15 | // Takes an instance of 'T' as the data. 16 | const factory Result.success(T data) = Success; 17 | } 18 | -------------------------------------------------------------------------------- /lib/data/datasources/local_data_source/app_local_datasource.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_architecture_template/data/repositories/data_source_contracts/local/app_local_datasource_contract.dart'; 2 | import 'package:shared_preferences/shared_preferences.dart'; 3 | 4 | class AppLocalDataSource implements AppLocalDataSourceContract { 5 | final SharedPreferences sharedPreferencesInstance; 6 | final String _hadValidToken = 'hadValidToken'; 7 | 8 | AppLocalDataSource({ 9 | required this.sharedPreferencesInstance, 10 | }); 11 | 12 | @override 13 | Future getValidToken() async { 14 | return sharedPreferencesInstance.getBool(_hadValidToken) ?? false; 15 | } 16 | 17 | @override 18 | Future setValidToken(bool value) async { 19 | await sharedPreferencesInstance.setBool(_hadValidToken, value); 20 | 21 | return; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/presentation/top_blocs/language_bloc/language_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:clean_architecture_template/presentation/top_blocs/language_bloc/language_bloc_event.dart'; 4 | import 'package:clean_architecture_template/presentation/top_blocs/language_bloc/language_bloc_state.dart'; 5 | import 'package:flutter_bloc/flutter_bloc.dart'; 6 | 7 | class LanguagesBloc extends Bloc { 8 | LanguagesBloc() 9 | : super( 10 | const LanguageBlocState( 11 | locale: Locale('es', 'ES'), 12 | ), 13 | ) { 14 | on( 15 | (event, emit) async { 16 | event.when(changedLanguage: (locale) { 17 | emit( 18 | state.copyWith(locale: locale), 19 | ); 20 | }); 21 | }, 22 | ); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /.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 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | /build/ 34 | 35 | # Symbolication related 36 | app.*.symbols 37 | 38 | # Obfuscation related 39 | app.*.map.json 40 | 41 | # Android Studio will place build artifacts here 42 | /android/app/debug 43 | /android/app/profile 44 | /android/app/release 45 | -------------------------------------------------------------------------------- /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 | 11.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Flutter (1.0.0) 3 | - shared_preferences_foundation (0.0.1): 4 | - Flutter 5 | - FlutterMacOS 6 | - url_launcher_ios (0.0.1): 7 | - Flutter 8 | 9 | DEPENDENCIES: 10 | - Flutter (from `Flutter`) 11 | - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`) 12 | - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) 13 | 14 | EXTERNAL SOURCES: 15 | Flutter: 16 | :path: Flutter 17 | shared_preferences_foundation: 18 | :path: ".symlinks/plugins/shared_preferences_foundation/ios" 19 | url_launcher_ios: 20 | :path: ".symlinks/plugins/url_launcher_ios/ios" 21 | 22 | SPEC CHECKSUMS: 23 | Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 24 | shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126 25 | url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4 26 | 27 | PODFILE CHECKSUM: fe4eb30d369f536b67bd22237ea178cc45b777c4 28 | 29 | COCOAPODS: 1.13.0 30 | -------------------------------------------------------------------------------- /lib/domain/models/example_entity.dart: -------------------------------------------------------------------------------- 1 | import 'package:freezed_annotation/freezed_annotation.dart'; 2 | import 'package:clean_architecture_template/data/models/example_remote_entity.dart'; 3 | 4 | part 'example_entity.freezed.dart'; 5 | 6 | part 'example_entity.g.dart'; 7 | 8 | @freezed 9 | class ExampleEntity with _$ExampleEntity { 10 | const factory ExampleEntity({ 11 | required int id, 12 | required int pk, 13 | required String status, 14 | required String title, 15 | required String primaryDescription, 16 | required String description, 17 | }) = _ExampleEntity; 18 | 19 | factory ExampleEntity.fromJson(Map json) => 20 | _$ExampleEntityFromJson(json); 21 | } 22 | 23 | extension ExampleRemoteEntityExtension on ExampleRemoteEntity { 24 | ExampleEntity toExampleEntity() => ExampleEntity( 25 | id: id, 26 | pk: pk, 27 | status: status, 28 | title: title, 29 | primaryDescription: primaryDescription, 30 | description: description, 31 | ); 32 | } 33 | -------------------------------------------------------------------------------- /lib/domain/models/example_entity.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'example_entity.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | _$_ExampleEntity _$$_ExampleEntityFromJson(Map json) => 10 | _$_ExampleEntity( 11 | id: json['id'] as int, 12 | pk: json['pk'] as int, 13 | status: json['status'] as String, 14 | title: json['title'] as String, 15 | primaryDescription: json['primaryDescription'] as String, 16 | description: json['description'] as String, 17 | ); 18 | 19 | Map _$$_ExampleEntityToJson(_$_ExampleEntity instance) => 20 | { 21 | 'id': instance.id, 22 | 'pk': instance.pk, 23 | 'status': instance.status, 24 | 'title': instance.title, 25 | 'primaryDescription': instance.primaryDescription, 26 | 'description': instance.description, 27 | }; 28 | -------------------------------------------------------------------------------- /lib/presentation/features/splash/splash_controller.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_architecture_template/app/routes/app_paths.dart'; 2 | import 'package:clean_architecture_template/presentation/features/splash/splash_bloc/splash_bloc.dart'; 3 | import 'package:clean_architecture_template/presentation/features/splash/splash_bloc/splash_state.dart'; 4 | import 'package:clean_architecture_template/presentation/features/splash/splash_screen.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:flutter_bloc/flutter_bloc.dart'; 7 | import 'package:go_router/go_router.dart'; 8 | 9 | class SplashController extends StatelessWidget { 10 | const SplashController({super.key}); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return BlocConsumer( 15 | listener: (context, state) { 16 | if (state.isSplashed()) { 17 | context.go(AppRoutePath.authController); 18 | } 19 | }, 20 | builder: (context, state) { 21 | return const SplashScreen(); 22 | }, 23 | ); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /lib/presentation/features/splash/splash_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_architecture_template/app/config/app_fonts.dart'; 2 | import 'package:clean_architecture_template/app/constants/app_colors.dart'; 3 | import 'package:flutter/material.dart'; 4 | 5 | class SplashScreen extends StatelessWidget { 6 | const SplashScreen({Key? key}) : super(key: key); 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | return Scaffold( 11 | backgroundColor: AppColors.primary, 12 | body: SafeArea( 13 | child: Column( 14 | children: [ 15 | const Spacer( 16 | flex: 1, 17 | ), 18 | Text( 19 | 'Clean Template', 20 | style: AppFonts.bodyMd.copyWith(color: AppColors.primaryWhite), 21 | ), 22 | const Divider( 23 | color: Colors.white, 24 | endIndent: 15, 25 | indent: 15, 26 | ), 27 | const Spacer( 28 | flex: 1, 29 | ), 30 | ], 31 | ), 32 | ), 33 | ); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/presentation/features/authentication/auth_controller.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_architecture_template/presentation/features/authentication/auth_bloc/auth_bloc.dart'; 2 | import 'package:clean_architecture_template/presentation/features/authentication/auth_bloc/auth_state.dart'; 3 | import 'package:clean_architecture_template/presentation/features/authentication/authentication_screen.dart'; 4 | import 'package:clean_architecture_template/presentation/features/home/home_screen.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:flutter_bloc/flutter_bloc.dart'; 7 | 8 | class AuthController extends StatelessWidget { 9 | const AuthController({Key? key}) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return BlocBuilder( 14 | builder: (context, state) { 15 | return state.userAuthStatus.when( 16 | unidentified: () => const AuthenticationScreen(), 17 | loggedIn: () => const HomeScreen(), 18 | error: () => const Text('An error happened'), 19 | ); 20 | }, 21 | ); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/data/models/example_remote_entity.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'example_remote_entity.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | _$_ExampleRemoteEntity _$$_ExampleRemoteEntityFromJson( 10 | Map json) => 11 | _$_ExampleRemoteEntity( 12 | id: json['id'] as int, 13 | pk: json['pk'] as int, 14 | status: json['status'] as String, 15 | title: json['title'] as String, 16 | primaryDescription: json['primary_description'] as String, 17 | description: json['description'] as String, 18 | ); 19 | 20 | Map _$$_ExampleRemoteEntityToJson( 21 | _$_ExampleRemoteEntity instance) => 22 | { 23 | 'id': instance.id, 24 | 'pk': instance.pk, 25 | 'status': instance.status, 26 | 'title': instance.title, 27 | 'primary_description': instance.primaryDescription, 28 | 'description': instance.description, 29 | }; 30 | -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility in the flutter_test package. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | void main() { 12 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 13 | // Build our app and trigger a frame. 14 | await tester.pumpWidget(const SizedBox()); 15 | 16 | // Verify that our counter starts at 0. 17 | expect(find.text('0'), findsOneWidget); 18 | expect(find.text('1'), findsNothing); 19 | 20 | // Tap the '+' icon and trigger a frame. 21 | await tester.tap(find.byIcon(Icons.add)); 22 | await tester.pump(); 23 | 24 | // Verify that our counter has incremented. 25 | expect(find.text('0'), findsNothing); 26 | expect(find.text('1'), findsOneWidget); 27 | }); 28 | } 29 | -------------------------------------------------------------------------------- /.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. 5 | 6 | version: 7 | revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 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: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 17 | base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 18 | - platform: android 19 | create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 20 | base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 21 | - platform: ios 22 | create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 23 | base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 24 | 25 | # User provided section 26 | 27 | # List of Local paths (relative to this file) that should be 28 | # ignored by the migrate tool. 29 | # 30 | # Files that are not part of the templates will be ignored by default. 31 | unmanaged_files: 32 | - 'lib/main.dart' 33 | - 'ios/Runner.xcodeproj/project.pbxproj' 34 | -------------------------------------------------------------------------------- /lib/presentation/features/authentication/auth_bloc/auth_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:freezed_annotation/freezed_annotation.dart'; 2 | import 'package:clean_architecture_template/app/types/auth_status.dart'; 3 | import 'package:clean_architecture_template/app/types/screen_status.dart'; 4 | 5 | part 'auth_state.freezed.dart'; 6 | 7 | /// The `AuthState` class represents the current state of the user's authentication status. 8 | /// 9 | /// [user] - An optional instance of the `User` class that contains the user's information. 10 | /// 11 | /// [userAuthStatus] - An instance of the `UserAuthStatus` class that represents the current authentication status of the user. 12 | @freezed 13 | class AuthState with _$AuthState { 14 | const factory AuthState({ 15 | required ScreenStatus screenStatus, 16 | required UserAuthStatus userAuthStatus, 17 | required bool isWelcomeTourFinished, 18 | }) = _AuthState; 19 | 20 | /// This factory method creates a new instance of `AuthState` with initial state. 21 | factory AuthState.initial() { 22 | return const AuthState( 23 | screenStatus: ScreenStatus.initial(), 24 | userAuthStatus: UserAuthStatus.unidentified(), 25 | isWelcomeTourFinished: false, 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/app/types/screen_status.dart: -------------------------------------------------------------------------------- 1 | import 'package:freezed_annotation/freezed_annotation.dart'; 2 | 3 | part 'screen_status.freezed.dart'; 4 | 5 | /// Represents the different statuses of a screen. 6 | @freezed 7 | class ScreenStatus with _$ScreenStatus { 8 | /// Represents the initial status of a screen. 9 | const factory ScreenStatus.initial() = _Initial; 10 | 11 | /// Represents the loading status of a screen. 12 | const factory ScreenStatus.loading() = _Loading; 13 | 14 | /// Represents the success status of a screen. 15 | const factory ScreenStatus.success() = _Success; 16 | 17 | /// Represents the success status of a screen. 18 | const factory ScreenStatus.loadingMore() = _LoadingMore; 19 | 20 | /// Represents the error status of a screen. 21 | const factory ScreenStatus.error([String? error]) = _Error; 22 | } 23 | 24 | /// Provides utility methods for the `ScreenStatus` class. 25 | extension ScreenStatusExtension on ScreenStatus { 26 | /// Returns `true` if the current status is `loading`, otherwise `false`. 27 | bool isLoading() => maybeWhen(orElse: () => false, loading: () => true); 28 | 29 | bool isLoadingMore() => 30 | maybeWhen(orElse: () => false, loadingMore: () => true); 31 | 32 | bool isError() => maybeWhen(orElse: () => false, error: (_) => true); 33 | } 34 | -------------------------------------------------------------------------------- /lib/data/datasources/remote_data_source/api/network/interceptors/mock_interceptor.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:dio/dio.dart'; 4 | import 'package:flutter/services.dart'; 5 | import 'package:clean_architecture_template/app/constants/mock_paths.dart'; 6 | 7 | // Class to handle mock requests 8 | class MockInterceptor extends InterceptorsWrapper { 9 | // Overrides the onRequest method to handle mock requests 10 | @override 11 | Future onRequest( 12 | RequestOptions options, 13 | RequestInterceptorHandler handler, 14 | ) async { 15 | try { 16 | // Loads the JSON data from assets 17 | final jsonData = await getJsonFromAssets( 18 | '${MocksPaths.mockPathBaseAssets}${options.path}.json', 19 | ); 20 | // Resolves the request with the loaded JSON data 21 | handler.resolve(Response(requestOptions: options, data: jsonData)); 22 | } catch (e) { 23 | // Rejects the request with a mock error 24 | handler.reject(DioError( 25 | requestOptions: options, 26 | type: DioErrorType.other, 27 | error: MocksPaths.error, 28 | )); 29 | } 30 | } 31 | 32 | // Loads JSON data from assets 33 | Future getJsonFromAssets(String path) async { 34 | final result = await rootBundle.loadString(path); 35 | 36 | return json.decode(result); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/app/di/top_bloc_provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_architecture_template/presentation/features/authentication/auth_bloc/auth_bloc.dart'; 2 | import 'package:clean_architecture_template/presentation/features/authentication/auth_bloc/auth_event.dart'; 3 | import 'package:clean_architecture_template/presentation/features/splash/splash_bloc/splash_bloc.dart'; 4 | import 'package:clean_architecture_template/presentation/features/splash/splash_bloc/splash_event.dart'; 5 | import 'package:clean_architecture_template/presentation/top_blocs/language_bloc/language_bloc.dart'; 6 | import 'package:flutter/material.dart'; 7 | import 'package:flutter_bloc/flutter_bloc.dart'; 8 | import 'package:get_it/get_it.dart'; 9 | 10 | class TopBlocProviders extends StatelessWidget { 11 | final Widget child; 12 | final _getIt = GetIt.instance; 13 | 14 | TopBlocProviders({Key? key, required this.child}) : super(key: key); 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return MultiBlocProvider( 19 | providers: [ 20 | BlocProvider(create: (context) => _getIt()), 21 | BlocProvider( 22 | create: (context) => _getIt() 23 | ..add( 24 | const AuthEvent.checkForValidToken(), 25 | ), 26 | ), 27 | BlocProvider( 28 | create: (context) => _getIt() 29 | ..add( 30 | const SplashEvent.unSplashInNMilliseconds(3000), 31 | ), 32 | ), 33 | ], 34 | child: child, 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lib/app/constants/app_colors.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class AppColors { 4 | static const Color primary = Color.fromRGBO(34, 77, 112, 1); 5 | static const Color primary200 = Color.fromRGBO(239, 243, 245, 1); 6 | static const Color secondary800 = Color(0xFF35759C); 7 | static const Color secondary = Color.fromRGBO(34, 77, 112, 1); 8 | static const Color complementary = Color.fromRGBO(14, 129, 149, 1); 9 | static const Color complementaryDisabled = Color.fromRGBO(216, 184, 236, 1); 10 | static const Color linkLight = Color(0xFF154481); 11 | static const Color a1 = Color.fromRGBO(205, 204, 52, 1); 12 | static const Color primaryWhite = Color.fromRGBO(255, 255, 255, 1); 13 | static const Color softGrey = Color.fromRGBO(249, 250, 251, 1); 14 | static const Color semanticInformation = Color.fromRGBO(0, 87, 255, 1); 15 | static const Color secondary900 = Color.fromRGBO(204, 165, 0, 1); 16 | static const Color greySoftColor = Color.fromRGBO(8, 9, 7, 0.7); 17 | static const Color naturalGrey = Color.fromRGBO(201, 201, 201, 1); 18 | static const Color naturalGrey2 = Color.fromRGBO(249, 249, 249, 1); 19 | static const Color naturalGrey50 = Color.fromRGBO(118, 118, 118, 1); 20 | static const Color naturalGrey70 = Color.fromRGBO(70, 70, 70, 1); 21 | static const Color black = Color.fromRGBO(14, 32, 47, 1); 22 | static const Color information100 = Color.fromRGBO(229, 238, 255, 1); 23 | static const Color softBlack = Color.fromRGBO(14, 32, 47, 0.7); 24 | static const Color disableBlack = Color.fromRGBO(24, 54, 78, 0.6); 25 | static const Color semanticInformation100 = Color.fromRGBO(255, 241, 229, 1); 26 | 27 | AppColors._(); 28 | } 29 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/data/datasources/remote_data_source/api/network/dio_http_client.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:dio/adapter.dart'; 4 | import 'package:dio/dio.dart'; 5 | import 'package:flutter/foundation.dart'; 6 | 7 | const _defaultConnectTimeout = Duration.millisecondsPerMinute; 8 | const _defaultReceiveTimeout = Duration.millisecondsPerMinute; 9 | 10 | class DioClient { 11 | static List? interceptors; 12 | static DioClient? _instance; 13 | static final Dio _dio = Dio(); 14 | 15 | factory DioClient() => _instance ?? DioClient._internal(); 16 | 17 | DioClient._internal() { 18 | _instance = this; 19 | } 20 | 21 | void addInterceptors(List interceptors) { 22 | _dio 23 | ..options.connectTimeout = _defaultConnectTimeout 24 | ..options.receiveTimeout = _defaultReceiveTimeout 25 | ..httpClientAdapter 26 | ..options.headers = {'Content-Type': 'application/json'}; 27 | if (interceptors.isNotEmpty) { 28 | _dio.interceptors.addAll(interceptors); 29 | } 30 | if (kDebugMode) { 31 | _dio.interceptors.add(LogInterceptor( 32 | responseBody: true, 33 | error: true, 34 | requestHeader: true, 35 | responseHeader: true, 36 | request: true, 37 | requestBody: true, 38 | )); 39 | } 40 | } 41 | 42 | void addBadCertificateCallBack() { 43 | (_dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = 44 | (HttpClient client) { 45 | client.badCertificateCallback = 46 | (X509Certificate cert, String host, int port) => true; 47 | 48 | return client; 49 | }; 50 | } 51 | 52 | /// Get Dio instance 53 | Dio getDio() { 54 | return _dio; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | 3 | linter: 4 | rules: 5 | prefer_single_quotes: true 6 | always_use_package_imports: true 7 | 8 | analyzer: 9 | plugins: 10 | - dart_code_metrics 11 | exclude: 12 | - "**/*.g.dart" 13 | - "**/*.freezed.dart" 14 | errors: 15 | invalid_annotation_target: ignore 16 | 17 | dart_code_metrics: 18 | anti-patterns: 19 | - long-method 20 | - long-parameter-list 21 | metrics-exclude: 22 | - test/** 23 | metrics: 24 | cyclomatic-complexity: 20 25 | maximum-nesting-level: 5 26 | number-of-parameters: 4 27 | source-lines-of-code: 100 28 | metrics-exclude: 29 | - test/** 30 | rules: 31 | - avoid-returning-widgets: 32 | ignored-names: 33 | - testFunction 34 | ignored-annotations: 35 | - allowedAnnotation 36 | - newline-before-return 37 | - no-boolean-literal-compare 38 | - no-empty-block 39 | - prefer-trailing-comma 40 | - prefer-conditional-expressions 41 | - no-equal-then-else 42 | - avoid-shrink-wrap-in-lists 43 | - avoid-non-null-assertion 44 | - avoid-redundant-async 45 | - avoid-throw-in-catch-block 46 | - avoid-unnecessary-type-casts 47 | - member-ordering: 48 | widgets-order: 49 | - constructor 50 | - named-constructor 51 | - const-fields 52 | - static-methods 53 | - final-fields 54 | - init-state-method 55 | - var-fields 56 | - init-state-method 57 | - private-methods 58 | - overridden-public-methods 59 | - build-method 60 | 61 | - always-remove-listener 62 | - avoid-wrapping-in-padding 63 | - avoid-expanded-as-spacer 64 | -------------------------------------------------------------------------------- /lib/app/config/app_fonts.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_architecture_template/app/constants/app_colors.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class AppFonts { 5 | static const TextStyle heading2 = TextStyle( 6 | fontFamily: 'Merriweather', 7 | fontWeight: FontWeight.w700, 8 | color: AppColors.black, 9 | fontSize: 19, 10 | ); 11 | static const TextStyle heading3 = TextStyle( 12 | fontFamily: 'Merriweather', 13 | fontWeight: FontWeight.w900, 14 | color: AppColors.black, 15 | fontSize: 20, 16 | ); 17 | static const TextStyle heading5 = TextStyle( 18 | fontFamily: 'Merriweather', 19 | fontWeight: FontWeight.w700, 20 | color: AppColors.black, 21 | fontSize: 16, 22 | ); 23 | 24 | static const TextStyle heading6 = TextStyle( 25 | fontFamily: 'Merriweather', 26 | fontWeight: FontWeight.w700, 27 | color: AppColors.black, 28 | fontSize: 16, 29 | ); 30 | static const TextStyle bodyMd = TextStyle( 31 | fontFamily: 'Nunito Sans', 32 | fontWeight: FontWeight.w400, 33 | color: AppColors.black, 34 | fontSize: 16, 35 | ); 36 | static const TextStyle bodyMdDisable = TextStyle( 37 | fontFamily: 'Nunito Sans', 38 | fontWeight: FontWeight.w700, 39 | color: AppColors.disableBlack, 40 | fontSize: 16, 41 | ); 42 | static const TextStyle labelXs = TextStyle( 43 | fontFamily: 'Nunito Sans', 44 | fontWeight: FontWeight.w500, 45 | color: AppColors.black, 46 | fontSize: 14, 47 | ); 48 | static const TextStyle labelXsUnderline = TextStyle( 49 | fontFamily: 'Nunito Sans', 50 | fontWeight: FontWeight.w500, 51 | color: AppColors.black, 52 | fontSize: 14, 53 | decoration: TextDecoration.underline, 54 | ); 55 | 56 | AppFonts._(); 57 | } 58 | -------------------------------------------------------------------------------- /lib/presentation/features/splash/splash_bloc/splash_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:clean_architecture_template/presentation/features/splash/splash_bloc/splash_event.dart'; 4 | import 'package:clean_architecture_template/presentation/features/splash/splash_bloc/splash_state.dart'; 5 | import 'package:flutter_bloc/flutter_bloc.dart'; 6 | 7 | /// The SplashBloc class extends the Bloc class from the flutter_bloc library, which implements the bloc design pattern for state management. 8 | /// 9 | /// This class handles the logic related to the splash screen of the application. 10 | class SplashBloc extends Bloc { 11 | /// Creates a new instance of the SplashBloc with an initial state of 12 | /// [SplashState.initial()]. 13 | SplashBloc() : super(const SplashState.initial()) { 14 | /// Listen for [SplashEvent]s and handle them with the [_unSplashInNMilliseconds] method. 15 | on((event, emit) async { 16 | await event.when( 17 | unSplashInNMilliseconds: (milliseconds) => 18 | _unSplashInNMilliseconds(event, emit, milliseconds), 19 | ); 20 | }); 21 | } 22 | 23 | /// Delays for the specified [milliseconds] and then emits a [SplashState.splashed()] state using the provided [emit] function. 24 | /// 25 | /// @param event The [SplashEvent] that triggered this method call. 26 | /// @param emit The function to use for emitting a new state. 27 | /// @param milliseconds The number of milliseconds to delay before emitting a new state. 28 | FutureOr _unSplashInNMilliseconds( 29 | SplashEvent event, 30 | Emitter emit, 31 | int milliseconds, 32 | ) async { 33 | await Future.delayed(Duration(milliseconds: milliseconds)); 34 | emit(const SplashState.splashed()); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /lib/app/types/repository_error.dart: -------------------------------------------------------------------------------- 1 | import 'package:freezed_annotation/freezed_annotation.dart'; 2 | import 'package:clean_architecture_template/app/types/errors/network_error.dart'; 3 | 4 | part 'repository_error.freezed.dart'; 5 | 6 | @freezed 7 | class RepositoryError with _$RepositoryError { 8 | const factory RepositoryError.badRequestListErrors(List listErrors) = 9 | badRequestListErrors; 10 | 11 | const factory RepositoryError.securityError() = SecurityError; 12 | 13 | const factory RepositoryError.badRequest() = badRequest; 14 | 15 | const factory RepositoryError.noAccess() = NoAccess; 16 | 17 | const factory RepositoryError.notFoundResource() = NotFoundResource; 18 | 19 | const factory RepositoryError.serverError() = ServerError; 20 | 21 | const factory RepositoryError.noInternetConnection() = NoInternetConnection; 22 | 23 | const factory RepositoryError.authExpired() = AuthExpired; 24 | 25 | const factory RepositoryError.infoNotMatching() = InfoNotMatching; 26 | 27 | const factory RepositoryError.listErrors(List errorList) = 28 | ListErrorsM; 29 | 30 | static RepositoryError fromDataSourceError(NetworkError error) { 31 | return error.maybeWhen( 32 | badRequestListErrors: (errors) => 33 | RepositoryError.badRequestListErrors(errors), 34 | infoNotMatching: RepositoryError.infoNotMatching, 35 | badRequest: () => const RepositoryError.badRequest(), 36 | forbidden: () => const RepositoryError.noAccess(), 37 | notFound: (_) => const RepositoryError.notFoundResource(), 38 | internalServerError: () => const RepositoryError.serverError(), 39 | noInternetConnection: () => const RepositoryError.noInternetConnection(), 40 | unauthorizedRequest: () => const RepositoryError.authExpired(), 41 | orElse: () => const RepositoryError.serverError(), 42 | ); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /lib/data/datasources/remote_data_source/api/app_api.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'app_api.dart'; 4 | 5 | // ************************************************************************** 6 | // RetrofitGenerator 7 | // ************************************************************************** 8 | 9 | // ignore_for_file: unnecessary_brace_in_string_interps,no_leading_underscores_for_local_identifiers 10 | 11 | class _AppApi implements AppApi { 12 | _AppApi( 13 | this._dio, { 14 | this.baseUrl, 15 | }); 16 | 17 | final Dio _dio; 18 | 19 | String? baseUrl; 20 | 21 | @override 22 | Future getMyExamples() async { 23 | const _extra = {}; 24 | final queryParameters = {}; 25 | final _headers = {}; 26 | final _data = {}; 27 | final _result = await _dio.fetch>( 28 | _setStreamType(Options( 29 | method: 'GET', 30 | headers: _headers, 31 | extra: _extra, 32 | ) 33 | .compose( 34 | _dio.options, 35 | '/api/example', 36 | queryParameters: queryParameters, 37 | data: _data, 38 | ) 39 | .copyWith(baseUrl: baseUrl ?? _dio.options.baseUrl))); 40 | final value = ExampleRemoteEntity.fromJson(_result.data!); 41 | return value; 42 | } 43 | 44 | RequestOptions _setStreamType(RequestOptions requestOptions) { 45 | if (T != dynamic && 46 | !(requestOptions.responseType == ResponseType.bytes || 47 | requestOptions.responseType == ResponseType.stream)) { 48 | if (T == String) { 49 | requestOptions.responseType = ResponseType.plain; 50 | } else { 51 | requestOptions.responseType = ResponseType.json; 52 | } 53 | } 54 | return requestOptions; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Clean Architecture Template 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | clean_architecture_template 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 | UIViewControllerBasedStatusBarAppearance 45 | 46 | CADisableMinimumFrameDurationOnPhone 47 | 48 | UIApplicationSupportsIndirectInputEvents 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '11.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 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | target.build_configurations.each do |config| 40 | xcconfig_path = config.base_configuration_reference.real_path 41 | xcconfig = File.read(xcconfig_path) 42 | xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR") 43 | File.open(xcconfig_path, "w") { |file| file << xcconfig_mod } 44 | end 45 | end 46 | installer.pods_project.targets.each do |target| 47 | flutter_additional_ios_build_settings(target) 48 | target.build_configurations.each do |config| 49 | config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0' 50 | end 51 | end 52 | end 53 | -------------------------------------------------------------------------------- /lib/data/repositories/app_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_architecture_template/app/types/errors/network_error.dart'; 2 | import 'package:clean_architecture_template/app/types/repository_error.dart'; 3 | import 'package:clean_architecture_template/app/types/result.dart'; 4 | import 'package:clean_architecture_template/data/repositories/data_source_contracts/local/app_local_datasource_contract.dart'; 5 | import 'package:clean_architecture_template/domain/repository_contracts/app_repository_contract.dart'; 6 | 7 | class AppRepository implements AppRepositoryContract { 8 | final AppLocalDataSourceContract _appLocalDataSourceContract; 9 | 10 | AppRepository( 11 | this._appLocalDataSourceContract, 12 | ); 13 | 14 | @override 15 | Future> getValidToken() async { 16 | try { 17 | // Call the getInvoices method from the remote data source 18 | final data = 19 | await _appLocalDataSourceContract.getValidToken(); 20 | 21 | // Return the result mapped 22 | return Result.success(data); 23 | } catch (error) { 24 | // Return the parsed error 25 | return Result.failure( 26 | error: RepositoryError.fromDataSourceError( 27 | NetworkError.fromException(error), 28 | ), 29 | ); 30 | } 31 | } 32 | 33 | @override 34 | Future> setValidToken(bool value) async { 35 | try { 36 | // Call the getInvoices method from the remote data source 37 | final data = 38 | await _appLocalDataSourceContract.setValidToken(value); 39 | 40 | // Return the result mapped 41 | return Result.success(data); 42 | } catch (error) { 43 | // Return the parsed error 44 | return Result.failure( 45 | error: RepositoryError.fromDataSourceError( 46 | NetworkError.fromException(error), 47 | ), 48 | ); 49 | } 50 | } 51 | 52 | @override 53 | Future> logIn() async { 54 | setValidToken(true); 55 | await Future.delayed(const Duration(seconds: 2)); 56 | 57 | return const Result.success(true); 58 | } 59 | 60 | @override 61 | Future> logOut() { 62 | return setValidToken(false); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /lib/app/di/di.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:clean_architecture_template/app/config/environment_config.dart'; 3 | import 'package:clean_architecture_template/app/constants/app_urls.dart'; 4 | import 'package:clean_architecture_template/data/datasources/local_data_source/app_local_datasource.dart'; 5 | import 'package:clean_architecture_template/data/datasources/remote_data_source/api/app_api.dart'; 6 | import 'package:clean_architecture_template/data/datasources/remote_data_source/api/network/dio_http_client.dart'; 7 | import 'package:clean_architecture_template/data/datasources/remote_data_source/api/network/interceptors/curl_dio_interceptor.dart'; 8 | import 'package:clean_architecture_template/data/datasources/remote_data_source/api/network/interceptors/mock_interceptor.dart'; 9 | import 'package:clean_architecture_template/data/datasources/remote_data_source/app_remote_data_source.dart'; 10 | import 'package:clean_architecture_template/data/repositories/app_repository.dart'; 11 | import 'package:clean_architecture_template/data/repositories/data_source_contracts/local/app_local_datasource_contract.dart'; 12 | import 'package:clean_architecture_template/data/repositories/data_source_contracts/remote/app_remote_data_source_contract.dart'; 13 | import 'package:clean_architecture_template/domain/repository_contracts/app_repository_contract.dart'; 14 | import 'package:clean_architecture_template/presentation/features/authentication/auth_bloc/auth_bloc.dart'; 15 | import 'package:clean_architecture_template/presentation/features/splash/splash_bloc/splash_bloc.dart'; 16 | import 'package:clean_architecture_template/presentation/top_blocs/language_bloc/language_bloc.dart'; 17 | import 'package:get_it/get_it.dart'; 18 | import 'package:shared_preferences/shared_preferences.dart'; 19 | 20 | part 'modules/api_modules.dart'; 21 | 22 | part 'modules/local_modules.dart'; 23 | 24 | part 'modules/remote_modules.dart'; 25 | 26 | part 'modules/repository_modules.dart'; 27 | 28 | part 'modules/ui_modules.dart'; 29 | 30 | Future initDi() async { 31 | _apiModulesInit(); 32 | _remoteModulesInit(); 33 | _localModulesInit(instance: await SharedPreferences.getInstance()); 34 | _repositoryModulesInit(); 35 | _uiModulesInit(); 36 | } 37 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_architecture_template/app/constants/app_constants.dart'; 2 | import 'package:clean_architecture_template/app/di/di.dart' as app_di; 3 | import 'package:clean_architecture_template/app/di/top_bloc_provider.dart'; 4 | import 'package:clean_architecture_template/app/routes/app_routes.dart'; 5 | import 'package:clean_architecture_template/presentation/top_blocs/language_bloc/language_bloc.dart'; 6 | import 'package:clean_architecture_template/presentation/top_blocs/language_bloc/language_bloc_state.dart'; 7 | import 'package:flutter/foundation.dart'; 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_bloc/flutter_bloc.dart'; 10 | import 'package:flutter_gen/gen_l10n/app_localizations.dart'; 11 | import 'package:flutter_localizations/flutter_localizations.dart'; 12 | import 'package:go_router/go_router.dart'; 13 | 14 | void main() async { 15 | WidgetsFlutterBinding.ensureInitialized(); 16 | await app_di.initDi(); 17 | runApp(MyApp()); 18 | } 19 | 20 | class MyApp extends StatelessWidget { 21 | final GoRouter _router = GoRouter( 22 | debugLogDiagnostics: kDebugMode, 23 | routes: appRoutes, 24 | ); 25 | 26 | MyApp({Key? key}) : super(key: key); 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | return TopBlocProviders( 31 | child: BlocBuilder( 32 | builder: (context, state) { 33 | return MaterialApp.router( 34 | debugShowCheckedModeBanner: false, 35 | routeInformationProvider: _router.routeInformationProvider, 36 | routeInformationParser: _router.routeInformationParser, 37 | routerDelegate: _router.routerDelegate, 38 | title: AppConstants.appName, 39 | localizationsDelegates: const [ 40 | AppLocalizations.delegate, 41 | GlobalMaterialLocalizations.delegate, 42 | GlobalWidgetsLocalizations.delegate, 43 | GlobalCupertinoLocalizations.delegate, 44 | ], 45 | locale: state.locale, 46 | supportedLocales: const [ 47 | Locale('es', ''), 48 | Locale('en', ''), 49 | ], 50 | ); 51 | }, 52 | ), 53 | ); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /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 flutter.compileSdkVersion 30 | ndkVersion flutter.ndkVersion 31 | 32 | compileOptions { 33 | sourceCompatibility JavaVersion.VERSION_1_8 34 | targetCompatibility JavaVersion.VERSION_1_8 35 | } 36 | 37 | kotlinOptions { 38 | jvmTarget = '1.8' 39 | } 40 | 41 | sourceSets { 42 | main.java.srcDirs += 'src/main/kotlin' 43 | } 44 | 45 | defaultConfig { 46 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 47 | applicationId "com.example.clean_architecture_template" 48 | // You can update the following values to match your application needs. 49 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. 50 | minSdkVersion flutter.minSdkVersion 51 | targetSdkVersion flutter.targetSdkVersion 52 | versionCode flutterVersionCode.toInteger() 53 | versionName flutterVersionName 54 | } 55 | 56 | buildTypes { 57 | release { 58 | // TODO: Add your own signing config for the release build. 59 | // Signing with the debug keys for now, so `flutter run --release` works. 60 | signingConfig signingConfigs.debug 61 | } 62 | } 63 | } 64 | 65 | flutter { 66 | source '../..' 67 | } 68 | 69 | dependencies { 70 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 71 | } 72 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /lib/presentation/features/home/home_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_architecture_template/app/config/app_fonts.dart'; 2 | import 'package:clean_architecture_template/app/extensions/context_extensions.dart'; 3 | import 'package:clean_architecture_template/presentation/features/authentication/auth_bloc/auth_bloc.dart'; 4 | import 'package:clean_architecture_template/presentation/features/authentication/auth_bloc/auth_event.dart'; 5 | import 'package:clean_architecture_template/presentation/top_blocs/language_bloc/language_bloc.dart'; 6 | import 'package:clean_architecture_template/presentation/top_blocs/language_bloc/language_bloc_event.dart'; 7 | import 'package:flutter/material.dart'; 8 | import 'package:flutter_bloc/flutter_bloc.dart'; 9 | 10 | class HomeScreen extends StatelessWidget { 11 | const HomeScreen({super.key}); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return Scaffold( 16 | appBar: AppBar( 17 | title: Text(context.localizations.home_screen_title), 18 | automaticallyImplyLeading: false, 19 | ), 20 | body: Center( 21 | child: Column( 22 | mainAxisAlignment: MainAxisAlignment.center, 23 | children: [ 24 | Text( 25 | context.localizations.welcome_text, 26 | style: AppFonts.bodyMd, 27 | ), 28 | Padding( 29 | padding: const EdgeInsets.all(8.0), 30 | child: DropdownButton( 31 | value: context.read().state.locale, 32 | onChanged: (value) => _changeLanguage(value, context), 33 | items: [ 34 | DropdownMenuItem( 35 | value: const Locale('es', 'ES'), 36 | child: Text(context.localizations.spanish_language_text), 37 | ), 38 | DropdownMenuItem( 39 | value: const Locale('en', 'US'), 40 | child: Text(context.localizations.english_language_text), 41 | ), 42 | ], 43 | ), 44 | ), 45 | const SizedBox(height: 20), 46 | ElevatedButton( 47 | onPressed: () => _logOut(context), 48 | child: Text(context.localizations.log_out_text), 49 | ), 50 | ], 51 | ), 52 | ), 53 | ); 54 | } 55 | 56 | void _logOut(BuildContext context) => 57 | context.read().add(const AuthEvent.signOutEvent()); 58 | 59 | void _changeLanguage(Locale? value, BuildContext context) { 60 | context.read().add( 61 | LanguageBlocEvent.changedLanguage( 62 | value ?? const Locale.fromSubtags(languageCode: 'es'), 63 | ), 64 | ); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /lib/app/types/errors/network_error_utils.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:clean_architecture_template/app/constants/mock_paths.dart'; 3 | import 'package:clean_architecture_template/app/types/errors/network_error.dart'; 4 | 5 | NetworkError getErrorFromDioError(DioError error) { 6 | final NetworkError networkExceptions; 7 | switch (error.type) { 8 | case DioErrorType.cancel: 9 | networkExceptions = const NetworkError.requestCancelled(); 10 | break; 11 | case DioErrorType.connectTimeout: 12 | networkExceptions = const NetworkError.requestTimeout(); 13 | break; 14 | case DioErrorType.other: 15 | if (error.error == MocksPaths.error) { 16 | networkExceptions = const NetworkError.mockNotFoundError(); 17 | } else if (error.toString().contains('is not a subtype of')) { 18 | networkExceptions = const NetworkError.unableToProcess(); 19 | } else { 20 | networkExceptions = const NetworkError.noInternetConnection(); 21 | } 22 | break; 23 | case DioErrorType.receiveTimeout: 24 | networkExceptions = const NetworkError.sendTimeout(); 25 | break; 26 | case DioErrorType.response: 27 | final errorDescription = 28 | error.response?.data?['error']?['error_description']; 29 | final errorType = error.response?.data?['error']?['error_type']; 30 | if (errorType != null && errorType == 'INFO_NOT_MATCHING') { 31 | return const NetworkError.infoNotMatching(); 32 | } 33 | 34 | if (errorDescription != null && errorDescription is List) { 35 | return NetworkError.badRequestListErrors( 36 | (errorDescription).map((e) => e as String).toList(), 37 | ); 38 | } 39 | 40 | networkExceptions = _checkStatusCode(error.response?.statusCode); 41 | break; 42 | case DioErrorType.sendTimeout: 43 | networkExceptions = const NetworkError.sendTimeout(); 44 | break; 45 | } 46 | 47 | return networkExceptions; 48 | } 49 | 50 | NetworkError _checkStatusCode(int? statusCode) { 51 | switch (statusCode) { 52 | case 400: 53 | return const NetworkError.badRequest(); 54 | case 401: 55 | return const NetworkError.unauthorizedRequest(); 56 | case 403: 57 | return const NetworkError.forbidden(); 58 | case 404: 59 | return const NetworkError.notFound('Not found'); 60 | case 409: 61 | return const NetworkError.conflict(); 62 | case 408: 63 | return const NetworkError.requestTimeout(); 64 | case 500: 65 | return const NetworkError.internalServerError(); 66 | case 503: 67 | return const NetworkError.serviceUnavailable(); 68 | default: 69 | var responseCode = statusCode; 70 | return NetworkError.defaultError( 71 | 'Received invalid status code: $responseCode', 72 | ); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /lib/app/types/errors/network_error.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:dio/dio.dart'; 4 | import 'package:flutter/foundation.dart'; 5 | import 'package:freezed_annotation/freezed_annotation.dart'; 6 | import 'package:clean_architecture_template/app/types/errors/network_error_utils.dart'; 7 | 8 | part 'network_error.freezed.dart'; 9 | 10 | @freezed 11 | class NetworkError with _$NetworkError { 12 | const factory NetworkError.badRequest() = _BadRequest; 13 | 14 | const factory NetworkError.badRequestListErrors(List listErrors) = 15 | _BadRequestListErrors; 16 | 17 | const factory NetworkError.conflict() = _Conflict; 18 | 19 | const factory NetworkError.defaultError(String error) = _DefaultError; 20 | 21 | const factory NetworkError.formatException() = _FormatException; 22 | 23 | const factory NetworkError.internalServerError() = _InternalServerError; 24 | 25 | const factory NetworkError.methodNotAllowed() = _MethodNotAllowed; 26 | 27 | const factory NetworkError.noInternetConnection() = _NoInternetConnection; 28 | 29 | const factory NetworkError.notAcceptable() = _NotAcceptable; 30 | 31 | const factory NetworkError.notFound(String reason) = _NotFound; 32 | 33 | const factory NetworkError.notImplemented() = _NotImplemented; 34 | 35 | const factory NetworkError.requestCancelled() = _RequestCancelled; 36 | 37 | const factory NetworkError.requestTimeout() = _RequestTimeout; 38 | 39 | const factory NetworkError.sendTimeout() = _SendTimeout; 40 | 41 | const factory NetworkError.serviceUnavailable() = _ServiceUnavailable; 42 | 43 | const factory NetworkError.unableToProcess() = _UnableToProcess; 44 | 45 | const factory NetworkError.unauthorizedRequest() = _UnauthorizedRequest; 46 | 47 | const factory NetworkError.forbidden() = _Forbidden; 48 | 49 | const factory NetworkError.unexpectedError() = _UnexpectedError; 50 | 51 | const factory NetworkError.mockNotFoundError() = _MockNotFoundError; 52 | 53 | const factory NetworkError.infoNotMatching() = _InfoNotMatching; 54 | 55 | static NetworkError fromException(error) { 56 | try { 57 | if (error is Exception) { 58 | NetworkError networkExceptions; 59 | if (error is DioError) { 60 | networkExceptions = getErrorFromDioError(error); 61 | } else if (error is SocketException) { 62 | networkExceptions = const NetworkError.noInternetConnection(); 63 | } else { 64 | networkExceptions = const NetworkError.unexpectedError(); 65 | } 66 | 67 | return networkExceptions; 68 | } else if (error is FormatException) { 69 | return const NetworkError.formatException(); 70 | } else { 71 | return error.toString().contains('is not a subtype of') 72 | ? const NetworkError.unableToProcess() 73 | : const NetworkError.unexpectedError(); 74 | } 75 | } catch (_) { 76 | return const NetworkError.unexpectedError(); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /lib/data/datasources/remote_data_source/api/network/interceptors/curl_dio_interceptor.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'dart:developer'; 3 | 4 | import 'package:dio/dio.dart'; 5 | 6 | class CurlLoggerDioInterceptor extends Interceptor { 7 | final bool? printOnSuccess; // optional boolean to print on successful request 8 | final bool convertFormData; // boolean to convert FormData to Map 9 | 10 | CurlLoggerDioInterceptor({this.printOnSuccess, this.convertFormData = true}); 11 | 12 | @override 13 | void onError(DioError err, ErrorInterceptorHandler handler) { 14 | // Call the _renderCurlRepresentation method and pass the requestOptions from the error 15 | _renderCurlRepresentation(err.requestOptions); 16 | 17 | // Call the next error handler 18 | return handler.next(err); 19 | } 20 | 21 | @override 22 | void onResponse( 23 | Response response, 24 | ResponseInterceptorHandler handler, 25 | ) { 26 | // If printOnSuccess is defined and set to true, call the _renderCurlRepresentation method and pass the requestOptions from the response 27 | if (printOnSuccess != null && printOnSuccess == true) { 28 | _renderCurlRepresentation(response.requestOptions); 29 | } 30 | 31 | // Call the next response handler 32 | return handler.next(response); 33 | } 34 | 35 | void _renderCurlRepresentation(RequestOptions requestOptions) { 36 | try { 37 | // Log the CURL representation of the request 38 | log(_cURLRepresentation(requestOptions)); 39 | } catch (err) { 40 | // If the representation cannot be created, log an error message 41 | log('unable to create a CURL representation of the requestOptions'); 42 | } 43 | } 44 | 45 | String _cURLRepresentation(RequestOptions options) { 46 | // Create a list of components for the CURL command 47 | List components = ['curl "${options.uri.toString()}"']; 48 | 49 | // If the request method is not GET, add the request method to the components 50 | if (options.method.toUpperCase() != 'GET') { 51 | components.add('-X ${options.method}'); 52 | } 53 | 54 | // Loop through the headers and add them to the components 55 | options.headers.forEach((k, v) { 56 | if (k != 'Cookie') { 57 | components.add('-H "$k: $v"'); 58 | } 59 | }); 60 | 61 | // If data is present, add it to the components 62 | if (options.data != null) { 63 | // If the data is a FormData and the convertFormData flag is true, convert it to a Map 64 | if (options.data is FormData && convertFormData) { 65 | options.data = Map.fromEntries(options.data.fields); 66 | } 67 | 68 | // Encode the data as a JSON string 69 | final data = json.encode(options.data); 70 | 71 | // Add the data to the components 72 | components.add('--data-raw "$data"'); 73 | } 74 | 75 | // Join the components with line breaks and return the result 76 | return components.join(' \\\n\t'); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /lib/presentation/features/authentication/auth_bloc/auth_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:clean_architecture_template/app/types/auth_status.dart'; 4 | import 'package:clean_architecture_template/app/types/screen_status.dart'; 5 | import 'package:clean_architecture_template/domain/repository_contracts/app_repository_contract.dart'; 6 | import 'package:clean_architecture_template/presentation/features/authentication/auth_bloc/auth_event.dart'; 7 | import 'package:clean_architecture_template/presentation/features/authentication/auth_bloc/auth_state.dart'; 8 | import 'package:flutter_bloc/flutter_bloc.dart'; 9 | 10 | /// A [Bloc] responsible for managing user authentication. 11 | class AuthBloc extends Bloc { 12 | final AppRepositoryContract _repository; 13 | 14 | /// Constructs an [AuthBloc] with the provided dependencies. 15 | AuthBloc({ 16 | required AppRepositoryContract repositoryContract, 17 | }) : _repository = repositoryContract, 18 | super( 19 | AuthState.initial(), 20 | ) { 21 | on( 22 | (event, emit) async { 23 | await event.when( 24 | signOutEvent: () { 25 | emit( 26 | state.copyWith( 27 | screenStatus: const ScreenStatus.initial(), 28 | userAuthStatus: const UserAuthStatus.unidentified(), 29 | ), 30 | ); 31 | }, 32 | signInEvent: () => _mapSignInEventToState(event, emit), 33 | checkForValidToken: () => _mapCheckForValidTokenToState(event, emit), 34 | ); 35 | }, 36 | ); 37 | } 38 | 39 | /// Maps the [AuthEvent.mockedSignIn] event to the appropriate state. 40 | FutureOr _mapSignInEventToState( 41 | AuthEvent event, 42 | Emitter emit, 43 | ) async { 44 | emit(state.copyWith(screenStatus: const ScreenStatus.loading())); 45 | 46 | final data = await _repository.logIn(); 47 | 48 | data.when( 49 | failure: (_) => emit( 50 | state.copyWith( 51 | screenStatus: const ScreenStatus.error(), 52 | ), 53 | ), 54 | success: (value) => emit( 55 | state.copyWith( 56 | userAuthStatus: const UserAuthStatus.loggedIn(), 57 | ), 58 | ), 59 | ); 60 | } 61 | 62 | FutureOr _mapCheckForValidTokenToState( 63 | AuthEvent event, 64 | Emitter emit, 65 | ) async { 66 | emit(state.copyWith(screenStatus: const ScreenStatus.loading())); 67 | 68 | final data = await _repository.getValidToken(); 69 | 70 | data.when( 71 | failure: (_) => emit( 72 | state.copyWith( 73 | screenStatus: const ScreenStatus.error(), 74 | userAuthStatus: const UserAuthStatus.unidentified(), 75 | ), 76 | ), 77 | success: (value) => emit( 78 | state.copyWith( 79 | userAuthStatus: value 80 | ? const UserAuthStatus.loggedIn() 81 | : const UserAuthStatus.unidentified(), 82 | ), 83 | ), 84 | ); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /lib/presentation/features/authentication/authentication_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_architecture_template/app/constants/app_colors.dart'; 2 | import 'package:clean_architecture_template/app/extensions/context_extensions.dart'; 3 | import 'package:clean_architecture_template/app/types/screen_status.dart'; 4 | import 'package:clean_architecture_template/presentation/features/authentication/auth_bloc/auth_bloc.dart'; 5 | import 'package:clean_architecture_template/presentation/features/authentication/auth_bloc/auth_event.dart'; 6 | import 'package:clean_architecture_template/presentation/features/authentication/auth_bloc/auth_state.dart'; 7 | import 'package:clean_architecture_template/presentation/widgets/custom_circular_loader.dart'; 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_bloc/flutter_bloc.dart'; 10 | 11 | class AuthenticationScreen extends StatelessWidget { 12 | const AuthenticationScreen({Key? key}) : super(key: key); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return BlocBuilder( 17 | builder: (context, state) { 18 | return Scaffold( 19 | backgroundColor: AppColors.primaryWhite, 20 | body: state.screenStatus.isLoading() 21 | ? const CustomCircularLoader() 22 | : Padding( 23 | padding: const EdgeInsets.all(16.0), 24 | child: Column( 25 | mainAxisAlignment: MainAxisAlignment.center, 26 | children: [ 27 | // Username Field 28 | Padding( 29 | padding: const EdgeInsets.symmetric(vertical: 10.0), 30 | child: TextField( 31 | decoration: InputDecoration( 32 | labelText: context.localizations.user_text, 33 | border: const OutlineInputBorder(), 34 | ), 35 | ), 36 | ), 37 | 38 | // Password Field 39 | Padding( 40 | padding: const EdgeInsets.symmetric(vertical: 10.0), 41 | child: TextField( 42 | obscureText: true, 43 | decoration: InputDecoration( 44 | labelText: context.localizations.password_text, 45 | border: const OutlineInputBorder(), 46 | ), 47 | ), 48 | ), 49 | 50 | // Login Button 51 | ElevatedButton( 52 | onPressed: () => context 53 | .read() 54 | .add(const AuthEvent.signInEvent()), 55 | child: Text(context.localizations.log_in_text), 56 | ), 57 | ], 58 | ), 59 | ), 60 | ); 61 | }, 62 | ); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /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.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /lib/presentation/top_blocs/language_bloc/language_bloc_state.freezed.dart: -------------------------------------------------------------------------------- 1 | // coverage:ignore-file 2 | // GENERATED CODE - DO NOT MODIFY BY HAND 3 | // ignore_for_file: type=lint 4 | // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target 5 | 6 | part of 'language_bloc_state.dart'; 7 | 8 | // ************************************************************************** 9 | // FreezedGenerator 10 | // ************************************************************************** 11 | 12 | T _$identity(T value) => value; 13 | 14 | final _privateConstructorUsedError = UnsupportedError( 15 | 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); 16 | 17 | /// @nodoc 18 | mixin _$LanguageBlocState { 19 | Locale get locale => throw _privateConstructorUsedError; 20 | 21 | @JsonKey(ignore: true) 22 | $LanguageBlocStateCopyWith get copyWith => 23 | throw _privateConstructorUsedError; 24 | } 25 | 26 | /// @nodoc 27 | abstract class $LanguageBlocStateCopyWith<$Res> { 28 | factory $LanguageBlocStateCopyWith( 29 | LanguageBlocState value, $Res Function(LanguageBlocState) then) = 30 | _$LanguageBlocStateCopyWithImpl<$Res, LanguageBlocState>; 31 | @useResult 32 | $Res call({Locale locale}); 33 | } 34 | 35 | /// @nodoc 36 | class _$LanguageBlocStateCopyWithImpl<$Res, $Val extends LanguageBlocState> 37 | implements $LanguageBlocStateCopyWith<$Res> { 38 | _$LanguageBlocStateCopyWithImpl(this._value, this._then); 39 | 40 | // ignore: unused_field 41 | final $Val _value; 42 | // ignore: unused_field 43 | final $Res Function($Val) _then; 44 | 45 | @pragma('vm:prefer-inline') 46 | @override 47 | $Res call({ 48 | Object? locale = null, 49 | }) { 50 | return _then(_value.copyWith( 51 | locale: null == locale 52 | ? _value.locale 53 | : locale // ignore: cast_nullable_to_non_nullable 54 | as Locale, 55 | ) as $Val); 56 | } 57 | } 58 | 59 | /// @nodoc 60 | abstract class _$$_LanguageBlocStateCopyWith<$Res> 61 | implements $LanguageBlocStateCopyWith<$Res> { 62 | factory _$$_LanguageBlocStateCopyWith(_$_LanguageBlocState value, 63 | $Res Function(_$_LanguageBlocState) then) = 64 | __$$_LanguageBlocStateCopyWithImpl<$Res>; 65 | @override 66 | @useResult 67 | $Res call({Locale locale}); 68 | } 69 | 70 | /// @nodoc 71 | class __$$_LanguageBlocStateCopyWithImpl<$Res> 72 | extends _$LanguageBlocStateCopyWithImpl<$Res, _$_LanguageBlocState> 73 | implements _$$_LanguageBlocStateCopyWith<$Res> { 74 | __$$_LanguageBlocStateCopyWithImpl( 75 | _$_LanguageBlocState _value, $Res Function(_$_LanguageBlocState) _then) 76 | : super(_value, _then); 77 | 78 | @pragma('vm:prefer-inline') 79 | @override 80 | $Res call({ 81 | Object? locale = null, 82 | }) { 83 | return _then(_$_LanguageBlocState( 84 | locale: null == locale 85 | ? _value.locale 86 | : locale // ignore: cast_nullable_to_non_nullable 87 | as Locale, 88 | )); 89 | } 90 | } 91 | 92 | /// @nodoc 93 | 94 | class _$_LanguageBlocState implements _LanguageBlocState { 95 | const _$_LanguageBlocState({required this.locale}); 96 | 97 | @override 98 | final Locale locale; 99 | 100 | @override 101 | String toString() { 102 | return 'LanguageBlocState(locale: $locale)'; 103 | } 104 | 105 | @override 106 | bool operator ==(dynamic other) { 107 | return identical(this, other) || 108 | (other.runtimeType == runtimeType && 109 | other is _$_LanguageBlocState && 110 | (identical(other.locale, locale) || other.locale == locale)); 111 | } 112 | 113 | @override 114 | int get hashCode => Object.hash(runtimeType, locale); 115 | 116 | @JsonKey(ignore: true) 117 | @override 118 | @pragma('vm:prefer-inline') 119 | _$$_LanguageBlocStateCopyWith<_$_LanguageBlocState> get copyWith => 120 | __$$_LanguageBlocStateCopyWithImpl<_$_LanguageBlocState>( 121 | this, _$identity); 122 | } 123 | 124 | abstract class _LanguageBlocState implements LanguageBlocState { 125 | const factory _LanguageBlocState({required final Locale locale}) = 126 | _$_LanguageBlocState; 127 | 128 | @override 129 | Locale get locale; 130 | @override 131 | @JsonKey(ignore: true) 132 | _$$_LanguageBlocStateCopyWith<_$_LanguageBlocState> get copyWith => 133 | throw _privateConstructorUsedError; 134 | } 135 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: clean_architecture_template 2 | description: A new Flutter project. 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `flutter pub publish`. This is preferred for private packages. 6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 7 | 8 | # The following defines the version and build number for your application. 9 | # A version number is three numbers separated by dots, like 1.2.43 10 | # followed by an optional build number separated by a +. 11 | # Both the version and the builder number may be overridden in flutter 12 | # build by specifying --build-name and --build-number, respectively. 13 | # In Android, build-name is used as versionName while build-number used as versionCode. 14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. 16 | # Read more about iOS versioning at 17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 18 | # In Windows, build-name is used as the major, minor, and patch parts 19 | # of the product and file versions while build-number is used as the build suffix. 20 | version: 1.0.0+1 21 | 22 | environment: 23 | sdk: '>=2.18.5 <3.0.0' 24 | 25 | # Dependencies specify other packages that your package needs in order to work. 26 | # To automatically upgrade your package dependencies to the latest versions 27 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 28 | # dependencies can be manually updated by changing the version numbers below to 29 | # the latest version available on pub.dev. To see which dependencies have newer 30 | # versions available, run `flutter pub outdated`. 31 | dependencies: 32 | flutter: 33 | sdk: flutter 34 | 35 | flutter_localizations: 36 | sdk: flutter 37 | 38 | go_router: ^6.0.1 39 | # Code generation 40 | # 41 | # Code-generators available to help you deal with immutable objects 42 | # https://pub.dev/packages/freezed 43 | freezed: ^2.1.1 44 | freezed_annotation: ^2.1.0 45 | 46 | # 47 | # To generate to/from JSON code for a class 48 | # https://pub.dev/packages/json_serializable 49 | json_serializable: ^6.5.4 50 | json_annotation: ^4.7.0 51 | 52 | # The following adds the Cupertino Icons font to your application. 53 | # Use with the CupertinoIcons class for iOS style icons. 54 | cupertino_icons: ^1.0.2 55 | 56 | 57 | # 58 | # To use SVG pictures 59 | # https://pub.dev/packages/flutter_svg 60 | flutter_svg: ^1.1.5 61 | 62 | shared_preferences: ^2.1.0 63 | 64 | intl: ^0.17.0 65 | # Generate native splash screen 66 | # Customize Flutter's default white native splash screen with background color and splash image. Supports dark mode, full screen, and more. 67 | # https://pub.dev/packages/flutter_native_splash 68 | # flutter_native_splash: ^2.2.17 69 | 70 | # Dependency injection 71 | # https://pub.dev/packages/get_it 72 | get_it: ^7.2.0 73 | # Network 74 | # 75 | # Http Client 76 | # https://pub.dev/packages/dio 77 | dio: ^4.0.6 78 | 79 | # Dio client generator 80 | # https://pub.dev/packages/retrofit 81 | retrofit: ">=3.0.0 <4.0.0" 82 | 83 | ## State Management 84 | # 85 | # Bloc State Management 86 | # https://pub.dev/packages/flutter_bloc 87 | flutter_bloc: ^8.0.1 88 | 89 | url_launcher: ^6.1.11 90 | 91 | dev_dependencies: 92 | flutter_test: 93 | sdk: flutter 94 | 95 | # The "flutter_lints" package below contains a set of recommended lints to 96 | # encourage good coding practices. The lint set provided by the package is 97 | # activated in the `analysis_options.yaml` file located at the root of your 98 | # package. See that file for information about deactivating specific lint 99 | # rules and activating additional ones. 100 | flutter_lints: ^2.0.1 101 | 102 | dart_code_metrics: ^4.19.2 103 | 104 | # Standalone generator 105 | # https://pub.dev/packages/build_runner 106 | build_runner: ^2.2.1 107 | 108 | # Http 109 | # 110 | # retrofit generator is an dio client generator using source_gen and inspired by Chopper and Retrofit. 111 | # https://pub.dev/packages/retrofit_generator 112 | retrofit_generator: ">=4.0.0 <5.0.0" 113 | 114 | # Testing 115 | # 116 | # A mock framework inspired by Mockito 117 | # https://pub.dev/packages/mockito 118 | mockito: ^5.3.2 119 | # 120 | # A testing library which makes it easy to test blocs. 121 | # https://pub.dev/packages/bloc_test 122 | bloc_test: ^9.1.0 123 | 124 | # For information on the generic Dart part of this file, see the 125 | # following page: https://dart.dev/tools/pub/pubspec 126 | 127 | flutter: 128 | generate: true 129 | uses-material-design: true 130 | assets: 131 | - assets/images/ 132 | - assets/icons/ 133 | 134 | fonts: 135 | - family: Merriweather 136 | fonts: 137 | - asset: assets/fonts/Merriweather-Black.ttf 138 | weight: 900 139 | - asset: assets/fonts/Merriweather-Regular.ttf 140 | weight: 400 141 | - family: Nunito Sans 142 | fonts: 143 | - asset: assets/fonts/NunitoSans_10pt-Bold.ttf 144 | weight: 700 145 | - asset: assets/fonts/NunitoSans_10pt-Regular.ttf 146 | weight: 400 147 | 148 | flutter_intl: 149 | enabled: true 150 | class_name: AppLocalizations 151 | 152 | # flutter_native_splash: 153 | # background_image: lib/assets/splash/splash_screen.png 154 | # android_12: lib/assets/splash/splash_screen.png 155 | # android_gravity: fill 156 | 157 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Flutter Clean Architecture Template 2 | 3 | Welcome to the **Flutter Clean Architecture Template**! This template is designed as a starting point for Flutter projects, adhering to clean architecture principles. Feel free to customize it to suit your project's needs. 4 | 5 | ## Project Overview 6 | 7 | This project follows a clean architecture pattern, aiming for modularity, maintainability, and scalability. Key packages and technologies used include: 8 | 9 | - **Get It:** Dependency injection is managed using the `get_it` package, providing flexibility in injecting dependencies. 10 | - **Go Router:** Navigation within the application is handled using the `go_router` package, providing a clean and customizable routing solution. 11 | - **Retrofit + Dio:** Network services and API calls are managed using the `retrofit` and `dio` packages, offering a convenient and efficient way to handle network requests. 12 | - **Freezed:** The `freezed` package is employed for creating immutable and efficient data models, enhancing the project's overall robustness. 13 | - **Flutter Bloc:** State management is achieved using the `flutter_bloc` package, providing a clear and maintainable way to handle app state. 14 | - **Shared Preferences:** An example of a local data source using shared preferences for persisting simple key-value data. 15 | 16 | ## Project Structure 17 | 18 | ```plaintext 19 | flutter-clean-architecture 20 | ├── app 21 | │   ├── config 22 | │   │   ├── app_fonts.dart 23 | │   │   ├── app_theme.dart 24 | │   │   └── environment_config.dart 25 | │   ├── constants 26 | │   │   ├── app_assets.dart 27 | │   │   ├── app_colors.dart 28 | │   │   ├── app_constants.dart 29 | │   │   ├── app_urls.dart 30 | │   │   └── mock_paths.dart 31 | │   ├── di 32 | │   │   ├── di.dart 33 | │   │   ├── modules 34 | │   │   │   ├── api_modules.dart 35 | │   │   │   ├── local_modules.dart 36 | │   │   │   ├── remote_modules.dart 37 | │   │   │   ├── repository_modules.dart 38 | │   │   │   └── ui_modules.dart 39 | │   │   └── top_bloc_provider.dart 40 | │   ├── extensions 41 | │   │   └── context_extensions.dart 42 | │   ├── l10n 43 | │   │   ├── app_en.arb 44 | │   │   └── app_es.arb 45 | │   ├── routes 46 | │   │   ├── app_paths.dart 47 | │   │   └── app_routes.dart 48 | │   ├── types 49 | │   │   ├── auth_status.dart 50 | │   │   ├── auth_status.freezed.dart 51 | │   │   ├── errors 52 | │   │   │   ├── network_error.dart 53 | │   │   │   ├── network_error.freezed.dart 54 | │   │   │   └── network_error_utils.dart 55 | │   │   ├── repository_error.dart 56 | │   │   ├── repository_error.freezed.dart 57 | │   │   ├── result.dart 58 | │   │   ├── result.freezed.dart 59 | │   │   ├── screen_status.dart 60 | │   │   └── screen_status.freezed.dart 61 | │   └── utils 62 | │   └── string_validators.dart 63 | ├── data 64 | │   ├── datasources 65 | │   │   ├── local_data_source 66 | │   │   │   └── app_local_datasource.dart 67 | │   │   └── remote_data_source 68 | │   │   ├── api 69 | │   │   │   ├── app_api.dart 70 | │   │   │   ├── app_api.g.dart 71 | │   │   │   └── network 72 | │   │   │   ├── dio_http_client.dart 73 | │   │   │   └── interceptors 74 | │   │   │   ├── curl_dio_interceptor.dart 75 | │   │   │   └── mock_interceptor.dart 76 | │   │   └── app_remote_data_source.dart 77 | │   ├── models 78 | │   │   ├── example_remote_entity.dart 79 | │   │   ├── example_remote_entity.freezed.dart 80 | │   │   └── example_remote_entity.g.dart 81 | │   └── repositories 82 | │   ├── app_repository.dart 83 | │   └── data_source_contracts 84 | │   ├── local 85 | │   │   └── app_local_datasource_contract.dart 86 | │   └── remote 87 | │   └── app_remote_data_source_contract.dart 88 | ├── domain 89 | │   ├── models 90 | │   │   ├── example_entity.dart 91 | │   │   ├── example_entity.freezed.dart 92 | │   │   └── example_entity.g.dart 93 | │   └── repository_contracts 94 | │   └── app_repository_contract.dart 95 | ├── main.dart 96 | └── presentation 97 | ├── features 98 | │   ├── authentication 99 | │   │   ├── auth_bloc 100 | │   │   │   ├── auth_bloc.dart 101 | │   │   │   ├── auth_event.dart 102 | │   │   │   ├── auth_event.freezed.dart 103 | │   │   │   ├── auth_state.dart 104 | │   │   │   └── auth_state.freezed.dart 105 | │   │   ├── auth_controller.dart 106 | │   │   └── authentication_screen.dart 107 | │   ├── home 108 | │   │   └── home_screen.dart 109 | │   └── splash 110 | │   ├── splash_bloc 111 | │   │   ├── splash_bloc.dart 112 | │   │   ├── splash_event.dart 113 | │   │   ├── splash_event.freezed.dart 114 | │   │   ├── splash_state.dart 115 | │   │   └── splash_state.freezed.dart 116 | │   ├── splash_controller.dart 117 | │   └── splash_screen.dart 118 | ├── top_blocs 119 | │   └── language_bloc 120 | │   ├── language_bloc.dart 121 | │   ├── language_bloc_event.dart 122 | │   ├── language_bloc_event.freezed.dart 123 | │   ├── language_bloc_state.dart 124 | │   └── language_bloc_state.freezed.dart 125 | └── widgets 126 | └── custom_circular_loader.dart 127 | 128 | ``` 129 | 130 | ## Features Implemented 131 | 132 | ### Authentication Controller 133 | The project includes an authentication controller responsible for managing user authentication, ensuring a secure and seamless experience. 134 | 135 | ### Splash Screen 136 | A splash screen with custom logic is implemented to enhance the user experience during the app's launch. 137 | 138 | ### Login Screen (Mocked) 139 | A login screen is included, showcasing a mocked login process. You can modify and extend this according to your authentication requirements. 140 | 141 | ### Home Screen 142 | The home screen provides the following functionalities: 143 | 144 | - **Logout:** Allows users to securely log out of their accounts. 145 | - **Language Change:** Users can change the language of the application. 146 | 147 | 148 | 149 | Feel free to customize and extend this template according to your project requirements. The clean architecture principles provide a solid foundation for scalability and maintainability. 150 | -------------------------------------------------------------------------------- /lib/presentation/top_blocs/language_bloc/language_bloc_event.freezed.dart: -------------------------------------------------------------------------------- 1 | // coverage:ignore-file 2 | // GENERATED CODE - DO NOT MODIFY BY HAND 3 | // ignore_for_file: type=lint 4 | // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target 5 | 6 | part of 'language_bloc_event.dart'; 7 | 8 | // ************************************************************************** 9 | // FreezedGenerator 10 | // ************************************************************************** 11 | 12 | T _$identity(T value) => value; 13 | 14 | final _privateConstructorUsedError = UnsupportedError( 15 | 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); 16 | 17 | /// @nodoc 18 | mixin _$LanguageBlocEvent { 19 | Locale get locale => throw _privateConstructorUsedError; 20 | @optionalTypeArgs 21 | TResult when({ 22 | required TResult Function(Locale locale) changedLanguage, 23 | }) => 24 | throw _privateConstructorUsedError; 25 | @optionalTypeArgs 26 | TResult? whenOrNull({ 27 | TResult? Function(Locale locale)? changedLanguage, 28 | }) => 29 | throw _privateConstructorUsedError; 30 | @optionalTypeArgs 31 | TResult maybeWhen({ 32 | TResult Function(Locale locale)? changedLanguage, 33 | required TResult orElse(), 34 | }) => 35 | throw _privateConstructorUsedError; 36 | @optionalTypeArgs 37 | TResult map({ 38 | required TResult Function(_ChangedLanguage value) changedLanguage, 39 | }) => 40 | throw _privateConstructorUsedError; 41 | @optionalTypeArgs 42 | TResult? mapOrNull({ 43 | TResult? Function(_ChangedLanguage value)? changedLanguage, 44 | }) => 45 | throw _privateConstructorUsedError; 46 | @optionalTypeArgs 47 | TResult maybeMap({ 48 | TResult Function(_ChangedLanguage value)? changedLanguage, 49 | required TResult orElse(), 50 | }) => 51 | throw _privateConstructorUsedError; 52 | 53 | @JsonKey(ignore: true) 54 | $LanguageBlocEventCopyWith get copyWith => 55 | throw _privateConstructorUsedError; 56 | } 57 | 58 | /// @nodoc 59 | abstract class $LanguageBlocEventCopyWith<$Res> { 60 | factory $LanguageBlocEventCopyWith( 61 | LanguageBlocEvent value, $Res Function(LanguageBlocEvent) then) = 62 | _$LanguageBlocEventCopyWithImpl<$Res, LanguageBlocEvent>; 63 | @useResult 64 | $Res call({Locale locale}); 65 | } 66 | 67 | /// @nodoc 68 | class _$LanguageBlocEventCopyWithImpl<$Res, $Val extends LanguageBlocEvent> 69 | implements $LanguageBlocEventCopyWith<$Res> { 70 | _$LanguageBlocEventCopyWithImpl(this._value, this._then); 71 | 72 | // ignore: unused_field 73 | final $Val _value; 74 | // ignore: unused_field 75 | final $Res Function($Val) _then; 76 | 77 | @pragma('vm:prefer-inline') 78 | @override 79 | $Res call({ 80 | Object? locale = null, 81 | }) { 82 | return _then(_value.copyWith( 83 | locale: null == locale 84 | ? _value.locale 85 | : locale // ignore: cast_nullable_to_non_nullable 86 | as Locale, 87 | ) as $Val); 88 | } 89 | } 90 | 91 | /// @nodoc 92 | abstract class _$$_ChangedLanguageCopyWith<$Res> 93 | implements $LanguageBlocEventCopyWith<$Res> { 94 | factory _$$_ChangedLanguageCopyWith( 95 | _$_ChangedLanguage value, $Res Function(_$_ChangedLanguage) then) = 96 | __$$_ChangedLanguageCopyWithImpl<$Res>; 97 | @override 98 | @useResult 99 | $Res call({Locale locale}); 100 | } 101 | 102 | /// @nodoc 103 | class __$$_ChangedLanguageCopyWithImpl<$Res> 104 | extends _$LanguageBlocEventCopyWithImpl<$Res, _$_ChangedLanguage> 105 | implements _$$_ChangedLanguageCopyWith<$Res> { 106 | __$$_ChangedLanguageCopyWithImpl( 107 | _$_ChangedLanguage _value, $Res Function(_$_ChangedLanguage) _then) 108 | : super(_value, _then); 109 | 110 | @pragma('vm:prefer-inline') 111 | @override 112 | $Res call({ 113 | Object? locale = null, 114 | }) { 115 | return _then(_$_ChangedLanguage( 116 | null == locale 117 | ? _value.locale 118 | : locale // ignore: cast_nullable_to_non_nullable 119 | as Locale, 120 | )); 121 | } 122 | } 123 | 124 | /// @nodoc 125 | 126 | class _$_ChangedLanguage implements _ChangedLanguage { 127 | const _$_ChangedLanguage(this.locale); 128 | 129 | @override 130 | final Locale locale; 131 | 132 | @override 133 | String toString() { 134 | return 'LanguageBlocEvent.changedLanguage(locale: $locale)'; 135 | } 136 | 137 | @override 138 | bool operator ==(dynamic other) { 139 | return identical(this, other) || 140 | (other.runtimeType == runtimeType && 141 | other is _$_ChangedLanguage && 142 | (identical(other.locale, locale) || other.locale == locale)); 143 | } 144 | 145 | @override 146 | int get hashCode => Object.hash(runtimeType, locale); 147 | 148 | @JsonKey(ignore: true) 149 | @override 150 | @pragma('vm:prefer-inline') 151 | _$$_ChangedLanguageCopyWith<_$_ChangedLanguage> get copyWith => 152 | __$$_ChangedLanguageCopyWithImpl<_$_ChangedLanguage>(this, _$identity); 153 | 154 | @override 155 | @optionalTypeArgs 156 | TResult when({ 157 | required TResult Function(Locale locale) changedLanguage, 158 | }) { 159 | return changedLanguage(locale); 160 | } 161 | 162 | @override 163 | @optionalTypeArgs 164 | TResult? whenOrNull({ 165 | TResult? Function(Locale locale)? changedLanguage, 166 | }) { 167 | return changedLanguage?.call(locale); 168 | } 169 | 170 | @override 171 | @optionalTypeArgs 172 | TResult maybeWhen({ 173 | TResult Function(Locale locale)? changedLanguage, 174 | required TResult orElse(), 175 | }) { 176 | if (changedLanguage != null) { 177 | return changedLanguage(locale); 178 | } 179 | return orElse(); 180 | } 181 | 182 | @override 183 | @optionalTypeArgs 184 | TResult map({ 185 | required TResult Function(_ChangedLanguage value) changedLanguage, 186 | }) { 187 | return changedLanguage(this); 188 | } 189 | 190 | @override 191 | @optionalTypeArgs 192 | TResult? mapOrNull({ 193 | TResult? Function(_ChangedLanguage value)? changedLanguage, 194 | }) { 195 | return changedLanguage?.call(this); 196 | } 197 | 198 | @override 199 | @optionalTypeArgs 200 | TResult maybeMap({ 201 | TResult Function(_ChangedLanguage value)? changedLanguage, 202 | required TResult orElse(), 203 | }) { 204 | if (changedLanguage != null) { 205 | return changedLanguage(this); 206 | } 207 | return orElse(); 208 | } 209 | } 210 | 211 | abstract class _ChangedLanguage implements LanguageBlocEvent { 212 | const factory _ChangedLanguage(final Locale locale) = _$_ChangedLanguage; 213 | 214 | @override 215 | Locale get locale; 216 | @override 217 | @JsonKey(ignore: true) 218 | _$$_ChangedLanguageCopyWith<_$_ChangedLanguage> get copyWith => 219 | throw _privateConstructorUsedError; 220 | } 221 | -------------------------------------------------------------------------------- /lib/presentation/features/authentication/auth_bloc/auth_state.freezed.dart: -------------------------------------------------------------------------------- 1 | // coverage:ignore-file 2 | // GENERATED CODE - DO NOT MODIFY BY HAND 3 | // ignore_for_file: type=lint 4 | // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target 5 | 6 | part of 'auth_state.dart'; 7 | 8 | // ************************************************************************** 9 | // FreezedGenerator 10 | // ************************************************************************** 11 | 12 | T _$identity(T value) => value; 13 | 14 | final _privateConstructorUsedError = UnsupportedError( 15 | 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); 16 | 17 | /// @nodoc 18 | mixin _$AuthState { 19 | ScreenStatus get screenStatus => throw _privateConstructorUsedError; 20 | UserAuthStatus get userAuthStatus => throw _privateConstructorUsedError; 21 | bool get isWelcomeTourFinished => throw _privateConstructorUsedError; 22 | 23 | @JsonKey(ignore: true) 24 | $AuthStateCopyWith get copyWith => 25 | throw _privateConstructorUsedError; 26 | } 27 | 28 | /// @nodoc 29 | abstract class $AuthStateCopyWith<$Res> { 30 | factory $AuthStateCopyWith(AuthState value, $Res Function(AuthState) then) = 31 | _$AuthStateCopyWithImpl<$Res, AuthState>; 32 | @useResult 33 | $Res call( 34 | {ScreenStatus screenStatus, 35 | UserAuthStatus userAuthStatus, 36 | bool isWelcomeTourFinished}); 37 | 38 | $ScreenStatusCopyWith<$Res> get screenStatus; 39 | $UserAuthStatusCopyWith<$Res> get userAuthStatus; 40 | } 41 | 42 | /// @nodoc 43 | class _$AuthStateCopyWithImpl<$Res, $Val extends AuthState> 44 | implements $AuthStateCopyWith<$Res> { 45 | _$AuthStateCopyWithImpl(this._value, this._then); 46 | 47 | // ignore: unused_field 48 | final $Val _value; 49 | // ignore: unused_field 50 | final $Res Function($Val) _then; 51 | 52 | @pragma('vm:prefer-inline') 53 | @override 54 | $Res call({ 55 | Object? screenStatus = null, 56 | Object? userAuthStatus = null, 57 | Object? isWelcomeTourFinished = null, 58 | }) { 59 | return _then(_value.copyWith( 60 | screenStatus: null == screenStatus 61 | ? _value.screenStatus 62 | : screenStatus // ignore: cast_nullable_to_non_nullable 63 | as ScreenStatus, 64 | userAuthStatus: null == userAuthStatus 65 | ? _value.userAuthStatus 66 | : userAuthStatus // ignore: cast_nullable_to_non_nullable 67 | as UserAuthStatus, 68 | isWelcomeTourFinished: null == isWelcomeTourFinished 69 | ? _value.isWelcomeTourFinished 70 | : isWelcomeTourFinished // ignore: cast_nullable_to_non_nullable 71 | as bool, 72 | ) as $Val); 73 | } 74 | 75 | @override 76 | @pragma('vm:prefer-inline') 77 | $ScreenStatusCopyWith<$Res> get screenStatus { 78 | return $ScreenStatusCopyWith<$Res>(_value.screenStatus, (value) { 79 | return _then(_value.copyWith(screenStatus: value) as $Val); 80 | }); 81 | } 82 | 83 | @override 84 | @pragma('vm:prefer-inline') 85 | $UserAuthStatusCopyWith<$Res> get userAuthStatus { 86 | return $UserAuthStatusCopyWith<$Res>(_value.userAuthStatus, (value) { 87 | return _then(_value.copyWith(userAuthStatus: value) as $Val); 88 | }); 89 | } 90 | } 91 | 92 | /// @nodoc 93 | abstract class _$$_AuthStateCopyWith<$Res> implements $AuthStateCopyWith<$Res> { 94 | factory _$$_AuthStateCopyWith( 95 | _$_AuthState value, $Res Function(_$_AuthState) then) = 96 | __$$_AuthStateCopyWithImpl<$Res>; 97 | @override 98 | @useResult 99 | $Res call( 100 | {ScreenStatus screenStatus, 101 | UserAuthStatus userAuthStatus, 102 | bool isWelcomeTourFinished}); 103 | 104 | @override 105 | $ScreenStatusCopyWith<$Res> get screenStatus; 106 | @override 107 | $UserAuthStatusCopyWith<$Res> get userAuthStatus; 108 | } 109 | 110 | /// @nodoc 111 | class __$$_AuthStateCopyWithImpl<$Res> 112 | extends _$AuthStateCopyWithImpl<$Res, _$_AuthState> 113 | implements _$$_AuthStateCopyWith<$Res> { 114 | __$$_AuthStateCopyWithImpl( 115 | _$_AuthState _value, $Res Function(_$_AuthState) _then) 116 | : super(_value, _then); 117 | 118 | @pragma('vm:prefer-inline') 119 | @override 120 | $Res call({ 121 | Object? screenStatus = null, 122 | Object? userAuthStatus = null, 123 | Object? isWelcomeTourFinished = null, 124 | }) { 125 | return _then(_$_AuthState( 126 | screenStatus: null == screenStatus 127 | ? _value.screenStatus 128 | : screenStatus // ignore: cast_nullable_to_non_nullable 129 | as ScreenStatus, 130 | userAuthStatus: null == userAuthStatus 131 | ? _value.userAuthStatus 132 | : userAuthStatus // ignore: cast_nullable_to_non_nullable 133 | as UserAuthStatus, 134 | isWelcomeTourFinished: null == isWelcomeTourFinished 135 | ? _value.isWelcomeTourFinished 136 | : isWelcomeTourFinished // ignore: cast_nullable_to_non_nullable 137 | as bool, 138 | )); 139 | } 140 | } 141 | 142 | /// @nodoc 143 | 144 | class _$_AuthState implements _AuthState { 145 | const _$_AuthState( 146 | {required this.screenStatus, 147 | required this.userAuthStatus, 148 | required this.isWelcomeTourFinished}); 149 | 150 | @override 151 | final ScreenStatus screenStatus; 152 | @override 153 | final UserAuthStatus userAuthStatus; 154 | @override 155 | final bool isWelcomeTourFinished; 156 | 157 | @override 158 | String toString() { 159 | return 'AuthState(screenStatus: $screenStatus, userAuthStatus: $userAuthStatus, isWelcomeTourFinished: $isWelcomeTourFinished)'; 160 | } 161 | 162 | @override 163 | bool operator ==(dynamic other) { 164 | return identical(this, other) || 165 | (other.runtimeType == runtimeType && 166 | other is _$_AuthState && 167 | (identical(other.screenStatus, screenStatus) || 168 | other.screenStatus == screenStatus) && 169 | (identical(other.userAuthStatus, userAuthStatus) || 170 | other.userAuthStatus == userAuthStatus) && 171 | (identical(other.isWelcomeTourFinished, isWelcomeTourFinished) || 172 | other.isWelcomeTourFinished == isWelcomeTourFinished)); 173 | } 174 | 175 | @override 176 | int get hashCode => Object.hash( 177 | runtimeType, screenStatus, userAuthStatus, isWelcomeTourFinished); 178 | 179 | @JsonKey(ignore: true) 180 | @override 181 | @pragma('vm:prefer-inline') 182 | _$$_AuthStateCopyWith<_$_AuthState> get copyWith => 183 | __$$_AuthStateCopyWithImpl<_$_AuthState>(this, _$identity); 184 | } 185 | 186 | abstract class _AuthState implements AuthState { 187 | const factory _AuthState( 188 | {required final ScreenStatus screenStatus, 189 | required final UserAuthStatus userAuthStatus, 190 | required final bool isWelcomeTourFinished}) = _$_AuthState; 191 | 192 | @override 193 | ScreenStatus get screenStatus; 194 | @override 195 | UserAuthStatus get userAuthStatus; 196 | @override 197 | bool get isWelcomeTourFinished; 198 | @override 199 | @JsonKey(ignore: true) 200 | _$$_AuthStateCopyWith<_$_AuthState> get copyWith => 201 | throw _privateConstructorUsedError; 202 | } 203 | -------------------------------------------------------------------------------- /lib/presentation/features/splash/splash_bloc/splash_event.freezed.dart: -------------------------------------------------------------------------------- 1 | // coverage:ignore-file 2 | // GENERATED CODE - DO NOT MODIFY BY HAND 3 | // ignore_for_file: type=lint 4 | // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target 5 | 6 | part of 'splash_event.dart'; 7 | 8 | // ************************************************************************** 9 | // FreezedGenerator 10 | // ************************************************************************** 11 | 12 | T _$identity(T value) => value; 13 | 14 | final _privateConstructorUsedError = UnsupportedError( 15 | 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); 16 | 17 | /// @nodoc 18 | mixin _$SplashEvent { 19 | int get milliseconds => throw _privateConstructorUsedError; 20 | @optionalTypeArgs 21 | TResult when({ 22 | required TResult Function(int milliseconds) unSplashInNMilliseconds, 23 | }) => 24 | throw _privateConstructorUsedError; 25 | @optionalTypeArgs 26 | TResult? whenOrNull({ 27 | TResult? Function(int milliseconds)? unSplashInNMilliseconds, 28 | }) => 29 | throw _privateConstructorUsedError; 30 | @optionalTypeArgs 31 | TResult maybeWhen({ 32 | TResult Function(int milliseconds)? unSplashInNMilliseconds, 33 | required TResult orElse(), 34 | }) => 35 | throw _privateConstructorUsedError; 36 | @optionalTypeArgs 37 | TResult map({ 38 | required TResult Function(_UnSplashInNMilliseconds value) 39 | unSplashInNMilliseconds, 40 | }) => 41 | throw _privateConstructorUsedError; 42 | @optionalTypeArgs 43 | TResult? mapOrNull({ 44 | TResult? Function(_UnSplashInNMilliseconds value)? unSplashInNMilliseconds, 45 | }) => 46 | throw _privateConstructorUsedError; 47 | @optionalTypeArgs 48 | TResult maybeMap({ 49 | TResult Function(_UnSplashInNMilliseconds value)? unSplashInNMilliseconds, 50 | required TResult orElse(), 51 | }) => 52 | throw _privateConstructorUsedError; 53 | 54 | @JsonKey(ignore: true) 55 | $SplashEventCopyWith get copyWith => 56 | throw _privateConstructorUsedError; 57 | } 58 | 59 | /// @nodoc 60 | abstract class $SplashEventCopyWith<$Res> { 61 | factory $SplashEventCopyWith( 62 | SplashEvent value, $Res Function(SplashEvent) then) = 63 | _$SplashEventCopyWithImpl<$Res, SplashEvent>; 64 | @useResult 65 | $Res call({int milliseconds}); 66 | } 67 | 68 | /// @nodoc 69 | class _$SplashEventCopyWithImpl<$Res, $Val extends SplashEvent> 70 | implements $SplashEventCopyWith<$Res> { 71 | _$SplashEventCopyWithImpl(this._value, this._then); 72 | 73 | // ignore: unused_field 74 | final $Val _value; 75 | // ignore: unused_field 76 | final $Res Function($Val) _then; 77 | 78 | @pragma('vm:prefer-inline') 79 | @override 80 | $Res call({ 81 | Object? milliseconds = null, 82 | }) { 83 | return _then(_value.copyWith( 84 | milliseconds: null == milliseconds 85 | ? _value.milliseconds 86 | : milliseconds // ignore: cast_nullable_to_non_nullable 87 | as int, 88 | ) as $Val); 89 | } 90 | } 91 | 92 | /// @nodoc 93 | abstract class _$$_UnSplashInNMillisecondsCopyWith<$Res> 94 | implements $SplashEventCopyWith<$Res> { 95 | factory _$$_UnSplashInNMillisecondsCopyWith(_$_UnSplashInNMilliseconds value, 96 | $Res Function(_$_UnSplashInNMilliseconds) then) = 97 | __$$_UnSplashInNMillisecondsCopyWithImpl<$Res>; 98 | @override 99 | @useResult 100 | $Res call({int milliseconds}); 101 | } 102 | 103 | /// @nodoc 104 | class __$$_UnSplashInNMillisecondsCopyWithImpl<$Res> 105 | extends _$SplashEventCopyWithImpl<$Res, _$_UnSplashInNMilliseconds> 106 | implements _$$_UnSplashInNMillisecondsCopyWith<$Res> { 107 | __$$_UnSplashInNMillisecondsCopyWithImpl(_$_UnSplashInNMilliseconds _value, 108 | $Res Function(_$_UnSplashInNMilliseconds) _then) 109 | : super(_value, _then); 110 | 111 | @pragma('vm:prefer-inline') 112 | @override 113 | $Res call({ 114 | Object? milliseconds = null, 115 | }) { 116 | return _then(_$_UnSplashInNMilliseconds( 117 | null == milliseconds 118 | ? _value.milliseconds 119 | : milliseconds // ignore: cast_nullable_to_non_nullable 120 | as int, 121 | )); 122 | } 123 | } 124 | 125 | /// @nodoc 126 | 127 | class _$_UnSplashInNMilliseconds implements _UnSplashInNMilliseconds { 128 | const _$_UnSplashInNMilliseconds(this.milliseconds); 129 | 130 | @override 131 | final int milliseconds; 132 | 133 | @override 134 | String toString() { 135 | return 'SplashEvent.unSplashInNMilliseconds(milliseconds: $milliseconds)'; 136 | } 137 | 138 | @override 139 | bool operator ==(dynamic other) { 140 | return identical(this, other) || 141 | (other.runtimeType == runtimeType && 142 | other is _$_UnSplashInNMilliseconds && 143 | (identical(other.milliseconds, milliseconds) || 144 | other.milliseconds == milliseconds)); 145 | } 146 | 147 | @override 148 | int get hashCode => Object.hash(runtimeType, milliseconds); 149 | 150 | @JsonKey(ignore: true) 151 | @override 152 | @pragma('vm:prefer-inline') 153 | _$$_UnSplashInNMillisecondsCopyWith<_$_UnSplashInNMilliseconds> 154 | get copyWith => 155 | __$$_UnSplashInNMillisecondsCopyWithImpl<_$_UnSplashInNMilliseconds>( 156 | this, _$identity); 157 | 158 | @override 159 | @optionalTypeArgs 160 | TResult when({ 161 | required TResult Function(int milliseconds) unSplashInNMilliseconds, 162 | }) { 163 | return unSplashInNMilliseconds(milliseconds); 164 | } 165 | 166 | @override 167 | @optionalTypeArgs 168 | TResult? whenOrNull({ 169 | TResult? Function(int milliseconds)? unSplashInNMilliseconds, 170 | }) { 171 | return unSplashInNMilliseconds?.call(milliseconds); 172 | } 173 | 174 | @override 175 | @optionalTypeArgs 176 | TResult maybeWhen({ 177 | TResult Function(int milliseconds)? unSplashInNMilliseconds, 178 | required TResult orElse(), 179 | }) { 180 | if (unSplashInNMilliseconds != null) { 181 | return unSplashInNMilliseconds(milliseconds); 182 | } 183 | return orElse(); 184 | } 185 | 186 | @override 187 | @optionalTypeArgs 188 | TResult map({ 189 | required TResult Function(_UnSplashInNMilliseconds value) 190 | unSplashInNMilliseconds, 191 | }) { 192 | return unSplashInNMilliseconds(this); 193 | } 194 | 195 | @override 196 | @optionalTypeArgs 197 | TResult? mapOrNull({ 198 | TResult? Function(_UnSplashInNMilliseconds value)? unSplashInNMilliseconds, 199 | }) { 200 | return unSplashInNMilliseconds?.call(this); 201 | } 202 | 203 | @override 204 | @optionalTypeArgs 205 | TResult maybeMap({ 206 | TResult Function(_UnSplashInNMilliseconds value)? unSplashInNMilliseconds, 207 | required TResult orElse(), 208 | }) { 209 | if (unSplashInNMilliseconds != null) { 210 | return unSplashInNMilliseconds(this); 211 | } 212 | return orElse(); 213 | } 214 | } 215 | 216 | abstract class _UnSplashInNMilliseconds implements SplashEvent { 217 | const factory _UnSplashInNMilliseconds(final int milliseconds) = 218 | _$_UnSplashInNMilliseconds; 219 | 220 | @override 221 | int get milliseconds; 222 | @override 223 | @JsonKey(ignore: true) 224 | _$$_UnSplashInNMillisecondsCopyWith<_$_UnSplashInNMilliseconds> 225 | get copyWith => throw _privateConstructorUsedError; 226 | } 227 | -------------------------------------------------------------------------------- /lib/presentation/features/splash/splash_bloc/splash_state.freezed.dart: -------------------------------------------------------------------------------- 1 | // coverage:ignore-file 2 | // GENERATED CODE - DO NOT MODIFY BY HAND 3 | // ignore_for_file: type=lint 4 | // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target 5 | 6 | part of 'splash_state.dart'; 7 | 8 | // ************************************************************************** 9 | // FreezedGenerator 10 | // ************************************************************************** 11 | 12 | T _$identity(T value) => value; 13 | 14 | final _privateConstructorUsedError = UnsupportedError( 15 | 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); 16 | 17 | /// @nodoc 18 | mixin _$SplashState { 19 | @optionalTypeArgs 20 | TResult when({ 21 | required TResult Function() initial, 22 | required TResult Function() splashed, 23 | }) => 24 | throw _privateConstructorUsedError; 25 | @optionalTypeArgs 26 | TResult? whenOrNull({ 27 | TResult? Function()? initial, 28 | TResult? Function()? splashed, 29 | }) => 30 | throw _privateConstructorUsedError; 31 | @optionalTypeArgs 32 | TResult maybeWhen({ 33 | TResult Function()? initial, 34 | TResult Function()? splashed, 35 | required TResult orElse(), 36 | }) => 37 | throw _privateConstructorUsedError; 38 | @optionalTypeArgs 39 | TResult map({ 40 | required TResult Function(_Initial value) initial, 41 | required TResult Function(_Splashed value) splashed, 42 | }) => 43 | throw _privateConstructorUsedError; 44 | @optionalTypeArgs 45 | TResult? mapOrNull({ 46 | TResult? Function(_Initial value)? initial, 47 | TResult? Function(_Splashed value)? splashed, 48 | }) => 49 | throw _privateConstructorUsedError; 50 | @optionalTypeArgs 51 | TResult maybeMap({ 52 | TResult Function(_Initial value)? initial, 53 | TResult Function(_Splashed value)? splashed, 54 | required TResult orElse(), 55 | }) => 56 | throw _privateConstructorUsedError; 57 | } 58 | 59 | /// @nodoc 60 | abstract class $SplashStateCopyWith<$Res> { 61 | factory $SplashStateCopyWith( 62 | SplashState value, $Res Function(SplashState) then) = 63 | _$SplashStateCopyWithImpl<$Res, SplashState>; 64 | } 65 | 66 | /// @nodoc 67 | class _$SplashStateCopyWithImpl<$Res, $Val extends SplashState> 68 | implements $SplashStateCopyWith<$Res> { 69 | _$SplashStateCopyWithImpl(this._value, this._then); 70 | 71 | // ignore: unused_field 72 | final $Val _value; 73 | // ignore: unused_field 74 | final $Res Function($Val) _then; 75 | } 76 | 77 | /// @nodoc 78 | abstract class _$$_InitialCopyWith<$Res> { 79 | factory _$$_InitialCopyWith( 80 | _$_Initial value, $Res Function(_$_Initial) then) = 81 | __$$_InitialCopyWithImpl<$Res>; 82 | } 83 | 84 | /// @nodoc 85 | class __$$_InitialCopyWithImpl<$Res> 86 | extends _$SplashStateCopyWithImpl<$Res, _$_Initial> 87 | implements _$$_InitialCopyWith<$Res> { 88 | __$$_InitialCopyWithImpl(_$_Initial _value, $Res Function(_$_Initial) _then) 89 | : super(_value, _then); 90 | } 91 | 92 | /// @nodoc 93 | 94 | class _$_Initial implements _Initial { 95 | const _$_Initial(); 96 | 97 | @override 98 | String toString() { 99 | return 'SplashState.initial()'; 100 | } 101 | 102 | @override 103 | bool operator ==(dynamic other) { 104 | return identical(this, other) || 105 | (other.runtimeType == runtimeType && other is _$_Initial); 106 | } 107 | 108 | @override 109 | int get hashCode => runtimeType.hashCode; 110 | 111 | @override 112 | @optionalTypeArgs 113 | TResult when({ 114 | required TResult Function() initial, 115 | required TResult Function() splashed, 116 | }) { 117 | return initial(); 118 | } 119 | 120 | @override 121 | @optionalTypeArgs 122 | TResult? whenOrNull({ 123 | TResult? Function()? initial, 124 | TResult? Function()? splashed, 125 | }) { 126 | return initial?.call(); 127 | } 128 | 129 | @override 130 | @optionalTypeArgs 131 | TResult maybeWhen({ 132 | TResult Function()? initial, 133 | TResult Function()? splashed, 134 | required TResult orElse(), 135 | }) { 136 | if (initial != null) { 137 | return initial(); 138 | } 139 | return orElse(); 140 | } 141 | 142 | @override 143 | @optionalTypeArgs 144 | TResult map({ 145 | required TResult Function(_Initial value) initial, 146 | required TResult Function(_Splashed value) splashed, 147 | }) { 148 | return initial(this); 149 | } 150 | 151 | @override 152 | @optionalTypeArgs 153 | TResult? mapOrNull({ 154 | TResult? Function(_Initial value)? initial, 155 | TResult? Function(_Splashed value)? splashed, 156 | }) { 157 | return initial?.call(this); 158 | } 159 | 160 | @override 161 | @optionalTypeArgs 162 | TResult maybeMap({ 163 | TResult Function(_Initial value)? initial, 164 | TResult Function(_Splashed value)? splashed, 165 | required TResult orElse(), 166 | }) { 167 | if (initial != null) { 168 | return initial(this); 169 | } 170 | return orElse(); 171 | } 172 | } 173 | 174 | abstract class _Initial implements SplashState { 175 | const factory _Initial() = _$_Initial; 176 | } 177 | 178 | /// @nodoc 179 | abstract class _$$_SplashedCopyWith<$Res> { 180 | factory _$$_SplashedCopyWith( 181 | _$_Splashed value, $Res Function(_$_Splashed) then) = 182 | __$$_SplashedCopyWithImpl<$Res>; 183 | } 184 | 185 | /// @nodoc 186 | class __$$_SplashedCopyWithImpl<$Res> 187 | extends _$SplashStateCopyWithImpl<$Res, _$_Splashed> 188 | implements _$$_SplashedCopyWith<$Res> { 189 | __$$_SplashedCopyWithImpl( 190 | _$_Splashed _value, $Res Function(_$_Splashed) _then) 191 | : super(_value, _then); 192 | } 193 | 194 | /// @nodoc 195 | 196 | class _$_Splashed implements _Splashed { 197 | const _$_Splashed(); 198 | 199 | @override 200 | String toString() { 201 | return 'SplashState.splashed()'; 202 | } 203 | 204 | @override 205 | bool operator ==(dynamic other) { 206 | return identical(this, other) || 207 | (other.runtimeType == runtimeType && other is _$_Splashed); 208 | } 209 | 210 | @override 211 | int get hashCode => runtimeType.hashCode; 212 | 213 | @override 214 | @optionalTypeArgs 215 | TResult when({ 216 | required TResult Function() initial, 217 | required TResult Function() splashed, 218 | }) { 219 | return splashed(); 220 | } 221 | 222 | @override 223 | @optionalTypeArgs 224 | TResult? whenOrNull({ 225 | TResult? Function()? initial, 226 | TResult? Function()? splashed, 227 | }) { 228 | return splashed?.call(); 229 | } 230 | 231 | @override 232 | @optionalTypeArgs 233 | TResult maybeWhen({ 234 | TResult Function()? initial, 235 | TResult Function()? splashed, 236 | required TResult orElse(), 237 | }) { 238 | if (splashed != null) { 239 | return splashed(); 240 | } 241 | return orElse(); 242 | } 243 | 244 | @override 245 | @optionalTypeArgs 246 | TResult map({ 247 | required TResult Function(_Initial value) initial, 248 | required TResult Function(_Splashed value) splashed, 249 | }) { 250 | return splashed(this); 251 | } 252 | 253 | @override 254 | @optionalTypeArgs 255 | TResult? mapOrNull({ 256 | TResult? Function(_Initial value)? initial, 257 | TResult? Function(_Splashed value)? splashed, 258 | }) { 259 | return splashed?.call(this); 260 | } 261 | 262 | @override 263 | @optionalTypeArgs 264 | TResult maybeMap({ 265 | TResult Function(_Initial value)? initial, 266 | TResult Function(_Splashed value)? splashed, 267 | required TResult orElse(), 268 | }) { 269 | if (splashed != null) { 270 | return splashed(this); 271 | } 272 | return orElse(); 273 | } 274 | } 275 | 276 | abstract class _Splashed implements SplashState { 277 | const factory _Splashed() = _$_Splashed; 278 | } 279 | -------------------------------------------------------------------------------- /lib/domain/models/example_entity.freezed.dart: -------------------------------------------------------------------------------- 1 | // coverage:ignore-file 2 | // GENERATED CODE - DO NOT MODIFY BY HAND 3 | // ignore_for_file: type=lint 4 | // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target 5 | 6 | part of 'example_entity.dart'; 7 | 8 | // ************************************************************************** 9 | // FreezedGenerator 10 | // ************************************************************************** 11 | 12 | T _$identity(T value) => value; 13 | 14 | final _privateConstructorUsedError = UnsupportedError( 15 | 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); 16 | 17 | ExampleEntity _$ExampleEntityFromJson(Map json) { 18 | return _ExampleEntity.fromJson(json); 19 | } 20 | 21 | /// @nodoc 22 | mixin _$ExampleEntity { 23 | int get id => throw _privateConstructorUsedError; 24 | int get pk => throw _privateConstructorUsedError; 25 | String get status => throw _privateConstructorUsedError; 26 | String get title => throw _privateConstructorUsedError; 27 | String get primaryDescription => throw _privateConstructorUsedError; 28 | String get description => throw _privateConstructorUsedError; 29 | 30 | Map toJson() => throw _privateConstructorUsedError; 31 | @JsonKey(ignore: true) 32 | $ExampleEntityCopyWith get copyWith => 33 | throw _privateConstructorUsedError; 34 | } 35 | 36 | /// @nodoc 37 | abstract class $ExampleEntityCopyWith<$Res> { 38 | factory $ExampleEntityCopyWith( 39 | ExampleEntity value, $Res Function(ExampleEntity) then) = 40 | _$ExampleEntityCopyWithImpl<$Res, ExampleEntity>; 41 | @useResult 42 | $Res call( 43 | {int id, 44 | int pk, 45 | String status, 46 | String title, 47 | String primaryDescription, 48 | String description}); 49 | } 50 | 51 | /// @nodoc 52 | class _$ExampleEntityCopyWithImpl<$Res, $Val extends ExampleEntity> 53 | implements $ExampleEntityCopyWith<$Res> { 54 | _$ExampleEntityCopyWithImpl(this._value, this._then); 55 | 56 | // ignore: unused_field 57 | final $Val _value; 58 | // ignore: unused_field 59 | final $Res Function($Val) _then; 60 | 61 | @pragma('vm:prefer-inline') 62 | @override 63 | $Res call({ 64 | Object? id = null, 65 | Object? pk = null, 66 | Object? status = null, 67 | Object? title = null, 68 | Object? primaryDescription = null, 69 | Object? description = null, 70 | }) { 71 | return _then(_value.copyWith( 72 | id: null == id 73 | ? _value.id 74 | : id // ignore: cast_nullable_to_non_nullable 75 | as int, 76 | pk: null == pk 77 | ? _value.pk 78 | : pk // ignore: cast_nullable_to_non_nullable 79 | as int, 80 | status: null == status 81 | ? _value.status 82 | : status // ignore: cast_nullable_to_non_nullable 83 | as String, 84 | title: null == title 85 | ? _value.title 86 | : title // ignore: cast_nullable_to_non_nullable 87 | as String, 88 | primaryDescription: null == primaryDescription 89 | ? _value.primaryDescription 90 | : primaryDescription // ignore: cast_nullable_to_non_nullable 91 | as String, 92 | description: null == description 93 | ? _value.description 94 | : description // ignore: cast_nullable_to_non_nullable 95 | as String, 96 | ) as $Val); 97 | } 98 | } 99 | 100 | /// @nodoc 101 | abstract class _$$_ExampleEntityCopyWith<$Res> 102 | implements $ExampleEntityCopyWith<$Res> { 103 | factory _$$_ExampleEntityCopyWith( 104 | _$_ExampleEntity value, $Res Function(_$_ExampleEntity) then) = 105 | __$$_ExampleEntityCopyWithImpl<$Res>; 106 | @override 107 | @useResult 108 | $Res call( 109 | {int id, 110 | int pk, 111 | String status, 112 | String title, 113 | String primaryDescription, 114 | String description}); 115 | } 116 | 117 | /// @nodoc 118 | class __$$_ExampleEntityCopyWithImpl<$Res> 119 | extends _$ExampleEntityCopyWithImpl<$Res, _$_ExampleEntity> 120 | implements _$$_ExampleEntityCopyWith<$Res> { 121 | __$$_ExampleEntityCopyWithImpl( 122 | _$_ExampleEntity _value, $Res Function(_$_ExampleEntity) _then) 123 | : super(_value, _then); 124 | 125 | @pragma('vm:prefer-inline') 126 | @override 127 | $Res call({ 128 | Object? id = null, 129 | Object? pk = null, 130 | Object? status = null, 131 | Object? title = null, 132 | Object? primaryDescription = null, 133 | Object? description = null, 134 | }) { 135 | return _then(_$_ExampleEntity( 136 | id: null == id 137 | ? _value.id 138 | : id // ignore: cast_nullable_to_non_nullable 139 | as int, 140 | pk: null == pk 141 | ? _value.pk 142 | : pk // ignore: cast_nullable_to_non_nullable 143 | as int, 144 | status: null == status 145 | ? _value.status 146 | : status // ignore: cast_nullable_to_non_nullable 147 | as String, 148 | title: null == title 149 | ? _value.title 150 | : title // ignore: cast_nullable_to_non_nullable 151 | as String, 152 | primaryDescription: null == primaryDescription 153 | ? _value.primaryDescription 154 | : primaryDescription // ignore: cast_nullable_to_non_nullable 155 | as String, 156 | description: null == description 157 | ? _value.description 158 | : description // ignore: cast_nullable_to_non_nullable 159 | as String, 160 | )); 161 | } 162 | } 163 | 164 | /// @nodoc 165 | @JsonSerializable() 166 | class _$_ExampleEntity implements _ExampleEntity { 167 | const _$_ExampleEntity( 168 | {required this.id, 169 | required this.pk, 170 | required this.status, 171 | required this.title, 172 | required this.primaryDescription, 173 | required this.description}); 174 | 175 | factory _$_ExampleEntity.fromJson(Map json) => 176 | _$$_ExampleEntityFromJson(json); 177 | 178 | @override 179 | final int id; 180 | @override 181 | final int pk; 182 | @override 183 | final String status; 184 | @override 185 | final String title; 186 | @override 187 | final String primaryDescription; 188 | @override 189 | final String description; 190 | 191 | @override 192 | String toString() { 193 | return 'ExampleEntity(id: $id, pk: $pk, status: $status, title: $title, primaryDescription: $primaryDescription, description: $description)'; 194 | } 195 | 196 | @override 197 | bool operator ==(dynamic other) { 198 | return identical(this, other) || 199 | (other.runtimeType == runtimeType && 200 | other is _$_ExampleEntity && 201 | (identical(other.id, id) || other.id == id) && 202 | (identical(other.pk, pk) || other.pk == pk) && 203 | (identical(other.status, status) || other.status == status) && 204 | (identical(other.title, title) || other.title == title) && 205 | (identical(other.primaryDescription, primaryDescription) || 206 | other.primaryDescription == primaryDescription) && 207 | (identical(other.description, description) || 208 | other.description == description)); 209 | } 210 | 211 | @JsonKey(ignore: true) 212 | @override 213 | int get hashCode => Object.hash( 214 | runtimeType, id, pk, status, title, primaryDescription, description); 215 | 216 | @JsonKey(ignore: true) 217 | @override 218 | @pragma('vm:prefer-inline') 219 | _$$_ExampleEntityCopyWith<_$_ExampleEntity> get copyWith => 220 | __$$_ExampleEntityCopyWithImpl<_$_ExampleEntity>(this, _$identity); 221 | 222 | @override 223 | Map toJson() { 224 | return _$$_ExampleEntityToJson( 225 | this, 226 | ); 227 | } 228 | } 229 | 230 | abstract class _ExampleEntity implements ExampleEntity { 231 | const factory _ExampleEntity( 232 | {required final int id, 233 | required final int pk, 234 | required final String status, 235 | required final String title, 236 | required final String primaryDescription, 237 | required final String description}) = _$_ExampleEntity; 238 | 239 | factory _ExampleEntity.fromJson(Map json) = 240 | _$_ExampleEntity.fromJson; 241 | 242 | @override 243 | int get id; 244 | @override 245 | int get pk; 246 | @override 247 | String get status; 248 | @override 249 | String get title; 250 | @override 251 | String get primaryDescription; 252 | @override 253 | String get description; 254 | @override 255 | @JsonKey(ignore: true) 256 | _$$_ExampleEntityCopyWith<_$_ExampleEntity> get copyWith => 257 | throw _privateConstructorUsedError; 258 | } 259 | -------------------------------------------------------------------------------- /lib/data/models/example_remote_entity.freezed.dart: -------------------------------------------------------------------------------- 1 | // coverage:ignore-file 2 | // GENERATED CODE - DO NOT MODIFY BY HAND 3 | // ignore_for_file: type=lint 4 | // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target 5 | 6 | part of 'example_remote_entity.dart'; 7 | 8 | // ************************************************************************** 9 | // FreezedGenerator 10 | // ************************************************************************** 11 | 12 | T _$identity(T value) => value; 13 | 14 | final _privateConstructorUsedError = UnsupportedError( 15 | 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); 16 | 17 | ExampleRemoteEntity _$ExampleRemoteEntityFromJson(Map json) { 18 | return _ExampleRemoteEntity.fromJson(json); 19 | } 20 | 21 | /// @nodoc 22 | mixin _$ExampleRemoteEntity { 23 | int get id => throw _privateConstructorUsedError; 24 | int get pk => throw _privateConstructorUsedError; 25 | String get status => throw _privateConstructorUsedError; 26 | String get title => throw _privateConstructorUsedError; 27 | @JsonKey(name: 'primary_description') 28 | String get primaryDescription => throw _privateConstructorUsedError; 29 | String get description => throw _privateConstructorUsedError; 30 | 31 | Map toJson() => throw _privateConstructorUsedError; 32 | @JsonKey(ignore: true) 33 | $ExampleRemoteEntityCopyWith get copyWith => 34 | throw _privateConstructorUsedError; 35 | } 36 | 37 | /// @nodoc 38 | abstract class $ExampleRemoteEntityCopyWith<$Res> { 39 | factory $ExampleRemoteEntityCopyWith( 40 | ExampleRemoteEntity value, $Res Function(ExampleRemoteEntity) then) = 41 | _$ExampleRemoteEntityCopyWithImpl<$Res, ExampleRemoteEntity>; 42 | @useResult 43 | $Res call( 44 | {int id, 45 | int pk, 46 | String status, 47 | String title, 48 | @JsonKey(name: 'primary_description') String primaryDescription, 49 | String description}); 50 | } 51 | 52 | /// @nodoc 53 | class _$ExampleRemoteEntityCopyWithImpl<$Res, $Val extends ExampleRemoteEntity> 54 | implements $ExampleRemoteEntityCopyWith<$Res> { 55 | _$ExampleRemoteEntityCopyWithImpl(this._value, this._then); 56 | 57 | // ignore: unused_field 58 | final $Val _value; 59 | // ignore: unused_field 60 | final $Res Function($Val) _then; 61 | 62 | @pragma('vm:prefer-inline') 63 | @override 64 | $Res call({ 65 | Object? id = null, 66 | Object? pk = null, 67 | Object? status = null, 68 | Object? title = null, 69 | Object? primaryDescription = null, 70 | Object? description = null, 71 | }) { 72 | return _then(_value.copyWith( 73 | id: null == id 74 | ? _value.id 75 | : id // ignore: cast_nullable_to_non_nullable 76 | as int, 77 | pk: null == pk 78 | ? _value.pk 79 | : pk // ignore: cast_nullable_to_non_nullable 80 | as int, 81 | status: null == status 82 | ? _value.status 83 | : status // ignore: cast_nullable_to_non_nullable 84 | as String, 85 | title: null == title 86 | ? _value.title 87 | : title // ignore: cast_nullable_to_non_nullable 88 | as String, 89 | primaryDescription: null == primaryDescription 90 | ? _value.primaryDescription 91 | : primaryDescription // ignore: cast_nullable_to_non_nullable 92 | as String, 93 | description: null == description 94 | ? _value.description 95 | : description // ignore: cast_nullable_to_non_nullable 96 | as String, 97 | ) as $Val); 98 | } 99 | } 100 | 101 | /// @nodoc 102 | abstract class _$$_ExampleRemoteEntityCopyWith<$Res> 103 | implements $ExampleRemoteEntityCopyWith<$Res> { 104 | factory _$$_ExampleRemoteEntityCopyWith(_$_ExampleRemoteEntity value, 105 | $Res Function(_$_ExampleRemoteEntity) then) = 106 | __$$_ExampleRemoteEntityCopyWithImpl<$Res>; 107 | @override 108 | @useResult 109 | $Res call( 110 | {int id, 111 | int pk, 112 | String status, 113 | String title, 114 | @JsonKey(name: 'primary_description') String primaryDescription, 115 | String description}); 116 | } 117 | 118 | /// @nodoc 119 | class __$$_ExampleRemoteEntityCopyWithImpl<$Res> 120 | extends _$ExampleRemoteEntityCopyWithImpl<$Res, _$_ExampleRemoteEntity> 121 | implements _$$_ExampleRemoteEntityCopyWith<$Res> { 122 | __$$_ExampleRemoteEntityCopyWithImpl(_$_ExampleRemoteEntity _value, 123 | $Res Function(_$_ExampleRemoteEntity) _then) 124 | : super(_value, _then); 125 | 126 | @pragma('vm:prefer-inline') 127 | @override 128 | $Res call({ 129 | Object? id = null, 130 | Object? pk = null, 131 | Object? status = null, 132 | Object? title = null, 133 | Object? primaryDescription = null, 134 | Object? description = null, 135 | }) { 136 | return _then(_$_ExampleRemoteEntity( 137 | id: null == id 138 | ? _value.id 139 | : id // ignore: cast_nullable_to_non_nullable 140 | as int, 141 | pk: null == pk 142 | ? _value.pk 143 | : pk // ignore: cast_nullable_to_non_nullable 144 | as int, 145 | status: null == status 146 | ? _value.status 147 | : status // ignore: cast_nullable_to_non_nullable 148 | as String, 149 | title: null == title 150 | ? _value.title 151 | : title // ignore: cast_nullable_to_non_nullable 152 | as String, 153 | primaryDescription: null == primaryDescription 154 | ? _value.primaryDescription 155 | : primaryDescription // ignore: cast_nullable_to_non_nullable 156 | as String, 157 | description: null == description 158 | ? _value.description 159 | : description // ignore: cast_nullable_to_non_nullable 160 | as String, 161 | )); 162 | } 163 | } 164 | 165 | /// @nodoc 166 | @JsonSerializable() 167 | class _$_ExampleRemoteEntity implements _ExampleRemoteEntity { 168 | const _$_ExampleRemoteEntity( 169 | {required this.id, 170 | required this.pk, 171 | required this.status, 172 | required this.title, 173 | @JsonKey(name: 'primary_description') required this.primaryDescription, 174 | required this.description}); 175 | 176 | factory _$_ExampleRemoteEntity.fromJson(Map json) => 177 | _$$_ExampleRemoteEntityFromJson(json); 178 | 179 | @override 180 | final int id; 181 | @override 182 | final int pk; 183 | @override 184 | final String status; 185 | @override 186 | final String title; 187 | @override 188 | @JsonKey(name: 'primary_description') 189 | final String primaryDescription; 190 | @override 191 | final String description; 192 | 193 | @override 194 | String toString() { 195 | return 'ExampleRemoteEntity(id: $id, pk: $pk, status: $status, title: $title, primaryDescription: $primaryDescription, description: $description)'; 196 | } 197 | 198 | @override 199 | bool operator ==(dynamic other) { 200 | return identical(this, other) || 201 | (other.runtimeType == runtimeType && 202 | other is _$_ExampleRemoteEntity && 203 | (identical(other.id, id) || other.id == id) && 204 | (identical(other.pk, pk) || other.pk == pk) && 205 | (identical(other.status, status) || other.status == status) && 206 | (identical(other.title, title) || other.title == title) && 207 | (identical(other.primaryDescription, primaryDescription) || 208 | other.primaryDescription == primaryDescription) && 209 | (identical(other.description, description) || 210 | other.description == description)); 211 | } 212 | 213 | @JsonKey(ignore: true) 214 | @override 215 | int get hashCode => Object.hash( 216 | runtimeType, id, pk, status, title, primaryDescription, description); 217 | 218 | @JsonKey(ignore: true) 219 | @override 220 | @pragma('vm:prefer-inline') 221 | _$$_ExampleRemoteEntityCopyWith<_$_ExampleRemoteEntity> get copyWith => 222 | __$$_ExampleRemoteEntityCopyWithImpl<_$_ExampleRemoteEntity>( 223 | this, _$identity); 224 | 225 | @override 226 | Map toJson() { 227 | return _$$_ExampleRemoteEntityToJson( 228 | this, 229 | ); 230 | } 231 | } 232 | 233 | abstract class _ExampleRemoteEntity implements ExampleRemoteEntity { 234 | const factory _ExampleRemoteEntity( 235 | {required final int id, 236 | required final int pk, 237 | required final String status, 238 | required final String title, 239 | @JsonKey(name: 'primary_description') 240 | required final String primaryDescription, 241 | required final String description}) = _$_ExampleRemoteEntity; 242 | 243 | factory _ExampleRemoteEntity.fromJson(Map json) = 244 | _$_ExampleRemoteEntity.fromJson; 245 | 246 | @override 247 | int get id; 248 | @override 249 | int get pk; 250 | @override 251 | String get status; 252 | @override 253 | String get title; 254 | @override 255 | @JsonKey(name: 'primary_description') 256 | String get primaryDescription; 257 | @override 258 | String get description; 259 | @override 260 | @JsonKey(ignore: true) 261 | _$$_ExampleRemoteEntityCopyWith<_$_ExampleRemoteEntity> get copyWith => 262 | throw _privateConstructorUsedError; 263 | } 264 | -------------------------------------------------------------------------------- /lib/app/types/result.freezed.dart: -------------------------------------------------------------------------------- 1 | // coverage:ignore-file 2 | // GENERATED CODE - DO NOT MODIFY BY HAND 3 | // ignore_for_file: type=lint 4 | // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target 5 | 6 | part of 'result.dart'; 7 | 8 | // ************************************************************************** 9 | // FreezedGenerator 10 | // ************************************************************************** 11 | 12 | T _$identity(T value) => value; 13 | 14 | final _privateConstructorUsedError = UnsupportedError( 15 | 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); 16 | 17 | /// @nodoc 18 | mixin _$Result { 19 | @optionalTypeArgs 20 | TResult when({ 21 | required TResult Function(RepositoryError error) failure, 22 | required TResult Function(T data) success, 23 | }) => 24 | throw _privateConstructorUsedError; 25 | @optionalTypeArgs 26 | TResult? whenOrNull({ 27 | TResult? Function(RepositoryError error)? failure, 28 | TResult? Function(T data)? success, 29 | }) => 30 | throw _privateConstructorUsedError; 31 | @optionalTypeArgs 32 | TResult maybeWhen({ 33 | TResult Function(RepositoryError error)? failure, 34 | TResult Function(T data)? success, 35 | required TResult orElse(), 36 | }) => 37 | throw _privateConstructorUsedError; 38 | @optionalTypeArgs 39 | TResult map({ 40 | required TResult Function(Failure value) failure, 41 | required TResult Function(Success value) success, 42 | }) => 43 | throw _privateConstructorUsedError; 44 | @optionalTypeArgs 45 | TResult? mapOrNull({ 46 | TResult? Function(Failure value)? failure, 47 | TResult? Function(Success value)? success, 48 | }) => 49 | throw _privateConstructorUsedError; 50 | @optionalTypeArgs 51 | TResult maybeMap({ 52 | TResult Function(Failure value)? failure, 53 | TResult Function(Success value)? success, 54 | required TResult orElse(), 55 | }) => 56 | throw _privateConstructorUsedError; 57 | } 58 | 59 | /// @nodoc 60 | abstract class $ResultCopyWith { 61 | factory $ResultCopyWith(Result value, $Res Function(Result) then) = 62 | _$ResultCopyWithImpl>; 63 | } 64 | 65 | /// @nodoc 66 | class _$ResultCopyWithImpl> 67 | implements $ResultCopyWith { 68 | _$ResultCopyWithImpl(this._value, this._then); 69 | 70 | // ignore: unused_field 71 | final $Val _value; 72 | // ignore: unused_field 73 | final $Res Function($Val) _then; 74 | } 75 | 76 | /// @nodoc 77 | abstract class _$$FailureCopyWith { 78 | factory _$$FailureCopyWith( 79 | _$Failure value, $Res Function(_$Failure) then) = 80 | __$$FailureCopyWithImpl; 81 | @useResult 82 | $Res call({RepositoryError error}); 83 | 84 | $RepositoryErrorCopyWith<$Res> get error; 85 | } 86 | 87 | /// @nodoc 88 | class __$$FailureCopyWithImpl 89 | extends _$ResultCopyWithImpl> 90 | implements _$$FailureCopyWith { 91 | __$$FailureCopyWithImpl( 92 | _$Failure _value, $Res Function(_$Failure) _then) 93 | : super(_value, _then); 94 | 95 | @pragma('vm:prefer-inline') 96 | @override 97 | $Res call({ 98 | Object? error = null, 99 | }) { 100 | return _then(_$Failure( 101 | error: null == error 102 | ? _value.error 103 | : error // ignore: cast_nullable_to_non_nullable 104 | as RepositoryError, 105 | )); 106 | } 107 | 108 | @override 109 | @pragma('vm:prefer-inline') 110 | $RepositoryErrorCopyWith<$Res> get error { 111 | return $RepositoryErrorCopyWith<$Res>(_value.error, (value) { 112 | return _then(_value.copyWith(error: value)); 113 | }); 114 | } 115 | } 116 | 117 | /// @nodoc 118 | 119 | class _$Failure implements Failure { 120 | const _$Failure({required this.error}); 121 | 122 | @override 123 | final RepositoryError error; 124 | 125 | @override 126 | String toString() { 127 | return 'Result<$T>.failure(error: $error)'; 128 | } 129 | 130 | @override 131 | bool operator ==(dynamic other) { 132 | return identical(this, other) || 133 | (other.runtimeType == runtimeType && 134 | other is _$Failure && 135 | (identical(other.error, error) || other.error == error)); 136 | } 137 | 138 | @override 139 | int get hashCode => Object.hash(runtimeType, error); 140 | 141 | @JsonKey(ignore: true) 142 | @override 143 | @pragma('vm:prefer-inline') 144 | _$$FailureCopyWith> get copyWith => 145 | __$$FailureCopyWithImpl>(this, _$identity); 146 | 147 | @override 148 | @optionalTypeArgs 149 | TResult when({ 150 | required TResult Function(RepositoryError error) failure, 151 | required TResult Function(T data) success, 152 | }) { 153 | return failure(error); 154 | } 155 | 156 | @override 157 | @optionalTypeArgs 158 | TResult? whenOrNull({ 159 | TResult? Function(RepositoryError error)? failure, 160 | TResult? Function(T data)? success, 161 | }) { 162 | return failure?.call(error); 163 | } 164 | 165 | @override 166 | @optionalTypeArgs 167 | TResult maybeWhen({ 168 | TResult Function(RepositoryError error)? failure, 169 | TResult Function(T data)? success, 170 | required TResult orElse(), 171 | }) { 172 | if (failure != null) { 173 | return failure(error); 174 | } 175 | return orElse(); 176 | } 177 | 178 | @override 179 | @optionalTypeArgs 180 | TResult map({ 181 | required TResult Function(Failure value) failure, 182 | required TResult Function(Success value) success, 183 | }) { 184 | return failure(this); 185 | } 186 | 187 | @override 188 | @optionalTypeArgs 189 | TResult? mapOrNull({ 190 | TResult? Function(Failure value)? failure, 191 | TResult? Function(Success value)? success, 192 | }) { 193 | return failure?.call(this); 194 | } 195 | 196 | @override 197 | @optionalTypeArgs 198 | TResult maybeMap({ 199 | TResult Function(Failure value)? failure, 200 | TResult Function(Success value)? success, 201 | required TResult orElse(), 202 | }) { 203 | if (failure != null) { 204 | return failure(this); 205 | } 206 | return orElse(); 207 | } 208 | } 209 | 210 | abstract class Failure implements Result { 211 | const factory Failure({required final RepositoryError error}) = _$Failure; 212 | 213 | RepositoryError get error; 214 | @JsonKey(ignore: true) 215 | _$$FailureCopyWith> get copyWith => 216 | throw _privateConstructorUsedError; 217 | } 218 | 219 | /// @nodoc 220 | abstract class _$$SuccessCopyWith { 221 | factory _$$SuccessCopyWith( 222 | _$Success value, $Res Function(_$Success) then) = 223 | __$$SuccessCopyWithImpl; 224 | @useResult 225 | $Res call({T data}); 226 | } 227 | 228 | /// @nodoc 229 | class __$$SuccessCopyWithImpl 230 | extends _$ResultCopyWithImpl> 231 | implements _$$SuccessCopyWith { 232 | __$$SuccessCopyWithImpl( 233 | _$Success _value, $Res Function(_$Success) _then) 234 | : super(_value, _then); 235 | 236 | @pragma('vm:prefer-inline') 237 | @override 238 | $Res call({ 239 | Object? data = null, 240 | }) { 241 | return _then(_$Success( 242 | null == data 243 | ? _value.data 244 | : data // ignore: cast_nullable_to_non_nullable 245 | as T, 246 | )); 247 | } 248 | } 249 | 250 | /// @nodoc 251 | 252 | class _$Success implements Success { 253 | const _$Success(this.data); 254 | 255 | @override 256 | final T data; 257 | 258 | @override 259 | String toString() { 260 | return 'Result<$T>.success(data: $data)'; 261 | } 262 | 263 | @override 264 | bool operator ==(dynamic other) { 265 | return identical(this, other) || 266 | (other.runtimeType == runtimeType && 267 | other is _$Success && 268 | const DeepCollectionEquality().equals(other.data, data)); 269 | } 270 | 271 | @override 272 | int get hashCode => 273 | Object.hash(runtimeType, const DeepCollectionEquality().hash(data)); 274 | 275 | @JsonKey(ignore: true) 276 | @override 277 | @pragma('vm:prefer-inline') 278 | _$$SuccessCopyWith> get copyWith => 279 | __$$SuccessCopyWithImpl>(this, _$identity); 280 | 281 | @override 282 | @optionalTypeArgs 283 | TResult when({ 284 | required TResult Function(RepositoryError error) failure, 285 | required TResult Function(T data) success, 286 | }) { 287 | return success(data); 288 | } 289 | 290 | @override 291 | @optionalTypeArgs 292 | TResult? whenOrNull({ 293 | TResult? Function(RepositoryError error)? failure, 294 | TResult? Function(T data)? success, 295 | }) { 296 | return success?.call(data); 297 | } 298 | 299 | @override 300 | @optionalTypeArgs 301 | TResult maybeWhen({ 302 | TResult Function(RepositoryError error)? failure, 303 | TResult Function(T data)? success, 304 | required TResult orElse(), 305 | }) { 306 | if (success != null) { 307 | return success(data); 308 | } 309 | return orElse(); 310 | } 311 | 312 | @override 313 | @optionalTypeArgs 314 | TResult map({ 315 | required TResult Function(Failure value) failure, 316 | required TResult Function(Success value) success, 317 | }) { 318 | return success(this); 319 | } 320 | 321 | @override 322 | @optionalTypeArgs 323 | TResult? mapOrNull({ 324 | TResult? Function(Failure value)? failure, 325 | TResult? Function(Success value)? success, 326 | }) { 327 | return success?.call(this); 328 | } 329 | 330 | @override 331 | @optionalTypeArgs 332 | TResult maybeMap({ 333 | TResult Function(Failure value)? failure, 334 | TResult Function(Success value)? success, 335 | required TResult orElse(), 336 | }) { 337 | if (success != null) { 338 | return success(this); 339 | } 340 | return orElse(); 341 | } 342 | } 343 | 344 | abstract class Success implements Result { 345 | const factory Success(final T data) = _$Success; 346 | 347 | T get data; 348 | @JsonKey(ignore: true) 349 | _$$SuccessCopyWith> get copyWith => 350 | throw _privateConstructorUsedError; 351 | } 352 | -------------------------------------------------------------------------------- /lib/app/types/auth_status.freezed.dart: -------------------------------------------------------------------------------- 1 | // coverage:ignore-file 2 | // GENERATED CODE - DO NOT MODIFY BY HAND 3 | // ignore_for_file: type=lint 4 | // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target 5 | 6 | part of 'auth_status.dart'; 7 | 8 | // ************************************************************************** 9 | // FreezedGenerator 10 | // ************************************************************************** 11 | 12 | T _$identity(T value) => value; 13 | 14 | final _privateConstructorUsedError = UnsupportedError( 15 | 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); 16 | 17 | /// @nodoc 18 | mixin _$UserAuthStatus { 19 | @optionalTypeArgs 20 | TResult when({ 21 | required TResult Function() unidentified, 22 | required TResult Function() loggedIn, 23 | required TResult Function() error, 24 | }) => 25 | throw _privateConstructorUsedError; 26 | @optionalTypeArgs 27 | TResult? whenOrNull({ 28 | TResult? Function()? unidentified, 29 | TResult? Function()? loggedIn, 30 | TResult? Function()? error, 31 | }) => 32 | throw _privateConstructorUsedError; 33 | @optionalTypeArgs 34 | TResult maybeWhen({ 35 | TResult Function()? unidentified, 36 | TResult Function()? loggedIn, 37 | TResult Function()? error, 38 | required TResult orElse(), 39 | }) => 40 | throw _privateConstructorUsedError; 41 | @optionalTypeArgs 42 | TResult map({ 43 | required TResult Function(_Unidentified value) unidentified, 44 | required TResult Function(_LoggedIn value) loggedIn, 45 | required TResult Function(_Error value) error, 46 | }) => 47 | throw _privateConstructorUsedError; 48 | @optionalTypeArgs 49 | TResult? mapOrNull({ 50 | TResult? Function(_Unidentified value)? unidentified, 51 | TResult? Function(_LoggedIn value)? loggedIn, 52 | TResult? Function(_Error value)? error, 53 | }) => 54 | throw _privateConstructorUsedError; 55 | @optionalTypeArgs 56 | TResult maybeMap({ 57 | TResult Function(_Unidentified value)? unidentified, 58 | TResult Function(_LoggedIn value)? loggedIn, 59 | TResult Function(_Error value)? error, 60 | required TResult orElse(), 61 | }) => 62 | throw _privateConstructorUsedError; 63 | } 64 | 65 | /// @nodoc 66 | abstract class $UserAuthStatusCopyWith<$Res> { 67 | factory $UserAuthStatusCopyWith( 68 | UserAuthStatus value, $Res Function(UserAuthStatus) then) = 69 | _$UserAuthStatusCopyWithImpl<$Res, UserAuthStatus>; 70 | } 71 | 72 | /// @nodoc 73 | class _$UserAuthStatusCopyWithImpl<$Res, $Val extends UserAuthStatus> 74 | implements $UserAuthStatusCopyWith<$Res> { 75 | _$UserAuthStatusCopyWithImpl(this._value, this._then); 76 | 77 | // ignore: unused_field 78 | final $Val _value; 79 | // ignore: unused_field 80 | final $Res Function($Val) _then; 81 | } 82 | 83 | /// @nodoc 84 | abstract class _$$_UnidentifiedCopyWith<$Res> { 85 | factory _$$_UnidentifiedCopyWith( 86 | _$_Unidentified value, $Res Function(_$_Unidentified) then) = 87 | __$$_UnidentifiedCopyWithImpl<$Res>; 88 | } 89 | 90 | /// @nodoc 91 | class __$$_UnidentifiedCopyWithImpl<$Res> 92 | extends _$UserAuthStatusCopyWithImpl<$Res, _$_Unidentified> 93 | implements _$$_UnidentifiedCopyWith<$Res> { 94 | __$$_UnidentifiedCopyWithImpl( 95 | _$_Unidentified _value, $Res Function(_$_Unidentified) _then) 96 | : super(_value, _then); 97 | } 98 | 99 | /// @nodoc 100 | 101 | class _$_Unidentified implements _Unidentified { 102 | const _$_Unidentified(); 103 | 104 | @override 105 | String toString() { 106 | return 'UserAuthStatus.unidentified()'; 107 | } 108 | 109 | @override 110 | bool operator ==(dynamic other) { 111 | return identical(this, other) || 112 | (other.runtimeType == runtimeType && other is _$_Unidentified); 113 | } 114 | 115 | @override 116 | int get hashCode => runtimeType.hashCode; 117 | 118 | @override 119 | @optionalTypeArgs 120 | TResult when({ 121 | required TResult Function() unidentified, 122 | required TResult Function() loggedIn, 123 | required TResult Function() error, 124 | }) { 125 | return unidentified(); 126 | } 127 | 128 | @override 129 | @optionalTypeArgs 130 | TResult? whenOrNull({ 131 | TResult? Function()? unidentified, 132 | TResult? Function()? loggedIn, 133 | TResult? Function()? error, 134 | }) { 135 | return unidentified?.call(); 136 | } 137 | 138 | @override 139 | @optionalTypeArgs 140 | TResult maybeWhen({ 141 | TResult Function()? unidentified, 142 | TResult Function()? loggedIn, 143 | TResult Function()? error, 144 | required TResult orElse(), 145 | }) { 146 | if (unidentified != null) { 147 | return unidentified(); 148 | } 149 | return orElse(); 150 | } 151 | 152 | @override 153 | @optionalTypeArgs 154 | TResult map({ 155 | required TResult Function(_Unidentified value) unidentified, 156 | required TResult Function(_LoggedIn value) loggedIn, 157 | required TResult Function(_Error value) error, 158 | }) { 159 | return unidentified(this); 160 | } 161 | 162 | @override 163 | @optionalTypeArgs 164 | TResult? mapOrNull({ 165 | TResult? Function(_Unidentified value)? unidentified, 166 | TResult? Function(_LoggedIn value)? loggedIn, 167 | TResult? Function(_Error value)? error, 168 | }) { 169 | return unidentified?.call(this); 170 | } 171 | 172 | @override 173 | @optionalTypeArgs 174 | TResult maybeMap({ 175 | TResult Function(_Unidentified value)? unidentified, 176 | TResult Function(_LoggedIn value)? loggedIn, 177 | TResult Function(_Error value)? error, 178 | required TResult orElse(), 179 | }) { 180 | if (unidentified != null) { 181 | return unidentified(this); 182 | } 183 | return orElse(); 184 | } 185 | } 186 | 187 | abstract class _Unidentified implements UserAuthStatus { 188 | const factory _Unidentified() = _$_Unidentified; 189 | } 190 | 191 | /// @nodoc 192 | abstract class _$$_LoggedInCopyWith<$Res> { 193 | factory _$$_LoggedInCopyWith( 194 | _$_LoggedIn value, $Res Function(_$_LoggedIn) then) = 195 | __$$_LoggedInCopyWithImpl<$Res>; 196 | } 197 | 198 | /// @nodoc 199 | class __$$_LoggedInCopyWithImpl<$Res> 200 | extends _$UserAuthStatusCopyWithImpl<$Res, _$_LoggedIn> 201 | implements _$$_LoggedInCopyWith<$Res> { 202 | __$$_LoggedInCopyWithImpl( 203 | _$_LoggedIn _value, $Res Function(_$_LoggedIn) _then) 204 | : super(_value, _then); 205 | } 206 | 207 | /// @nodoc 208 | 209 | class _$_LoggedIn implements _LoggedIn { 210 | const _$_LoggedIn(); 211 | 212 | @override 213 | String toString() { 214 | return 'UserAuthStatus.loggedIn()'; 215 | } 216 | 217 | @override 218 | bool operator ==(dynamic other) { 219 | return identical(this, other) || 220 | (other.runtimeType == runtimeType && other is _$_LoggedIn); 221 | } 222 | 223 | @override 224 | int get hashCode => runtimeType.hashCode; 225 | 226 | @override 227 | @optionalTypeArgs 228 | TResult when({ 229 | required TResult Function() unidentified, 230 | required TResult Function() loggedIn, 231 | required TResult Function() error, 232 | }) { 233 | return loggedIn(); 234 | } 235 | 236 | @override 237 | @optionalTypeArgs 238 | TResult? whenOrNull({ 239 | TResult? Function()? unidentified, 240 | TResult? Function()? loggedIn, 241 | TResult? Function()? error, 242 | }) { 243 | return loggedIn?.call(); 244 | } 245 | 246 | @override 247 | @optionalTypeArgs 248 | TResult maybeWhen({ 249 | TResult Function()? unidentified, 250 | TResult Function()? loggedIn, 251 | TResult Function()? error, 252 | required TResult orElse(), 253 | }) { 254 | if (loggedIn != null) { 255 | return loggedIn(); 256 | } 257 | return orElse(); 258 | } 259 | 260 | @override 261 | @optionalTypeArgs 262 | TResult map({ 263 | required TResult Function(_Unidentified value) unidentified, 264 | required TResult Function(_LoggedIn value) loggedIn, 265 | required TResult Function(_Error value) error, 266 | }) { 267 | return loggedIn(this); 268 | } 269 | 270 | @override 271 | @optionalTypeArgs 272 | TResult? mapOrNull({ 273 | TResult? Function(_Unidentified value)? unidentified, 274 | TResult? Function(_LoggedIn value)? loggedIn, 275 | TResult? Function(_Error value)? error, 276 | }) { 277 | return loggedIn?.call(this); 278 | } 279 | 280 | @override 281 | @optionalTypeArgs 282 | TResult maybeMap({ 283 | TResult Function(_Unidentified value)? unidentified, 284 | TResult Function(_LoggedIn value)? loggedIn, 285 | TResult Function(_Error value)? error, 286 | required TResult orElse(), 287 | }) { 288 | if (loggedIn != null) { 289 | return loggedIn(this); 290 | } 291 | return orElse(); 292 | } 293 | } 294 | 295 | abstract class _LoggedIn implements UserAuthStatus { 296 | const factory _LoggedIn() = _$_LoggedIn; 297 | } 298 | 299 | /// @nodoc 300 | abstract class _$$_ErrorCopyWith<$Res> { 301 | factory _$$_ErrorCopyWith(_$_Error value, $Res Function(_$_Error) then) = 302 | __$$_ErrorCopyWithImpl<$Res>; 303 | } 304 | 305 | /// @nodoc 306 | class __$$_ErrorCopyWithImpl<$Res> 307 | extends _$UserAuthStatusCopyWithImpl<$Res, _$_Error> 308 | implements _$$_ErrorCopyWith<$Res> { 309 | __$$_ErrorCopyWithImpl(_$_Error _value, $Res Function(_$_Error) _then) 310 | : super(_value, _then); 311 | } 312 | 313 | /// @nodoc 314 | 315 | class _$_Error implements _Error { 316 | const _$_Error(); 317 | 318 | @override 319 | String toString() { 320 | return 'UserAuthStatus.error()'; 321 | } 322 | 323 | @override 324 | bool operator ==(dynamic other) { 325 | return identical(this, other) || 326 | (other.runtimeType == runtimeType && other is _$_Error); 327 | } 328 | 329 | @override 330 | int get hashCode => runtimeType.hashCode; 331 | 332 | @override 333 | @optionalTypeArgs 334 | TResult when({ 335 | required TResult Function() unidentified, 336 | required TResult Function() loggedIn, 337 | required TResult Function() error, 338 | }) { 339 | return error(); 340 | } 341 | 342 | @override 343 | @optionalTypeArgs 344 | TResult? whenOrNull({ 345 | TResult? Function()? unidentified, 346 | TResult? Function()? loggedIn, 347 | TResult? Function()? error, 348 | }) { 349 | return error?.call(); 350 | } 351 | 352 | @override 353 | @optionalTypeArgs 354 | TResult maybeWhen({ 355 | TResult Function()? unidentified, 356 | TResult Function()? loggedIn, 357 | TResult Function()? error, 358 | required TResult orElse(), 359 | }) { 360 | if (error != null) { 361 | return error(); 362 | } 363 | return orElse(); 364 | } 365 | 366 | @override 367 | @optionalTypeArgs 368 | TResult map({ 369 | required TResult Function(_Unidentified value) unidentified, 370 | required TResult Function(_LoggedIn value) loggedIn, 371 | required TResult Function(_Error value) error, 372 | }) { 373 | return error(this); 374 | } 375 | 376 | @override 377 | @optionalTypeArgs 378 | TResult? mapOrNull({ 379 | TResult? Function(_Unidentified value)? unidentified, 380 | TResult? Function(_LoggedIn value)? loggedIn, 381 | TResult? Function(_Error value)? error, 382 | }) { 383 | return error?.call(this); 384 | } 385 | 386 | @override 387 | @optionalTypeArgs 388 | TResult maybeMap({ 389 | TResult Function(_Unidentified value)? unidentified, 390 | TResult Function(_LoggedIn value)? loggedIn, 391 | TResult Function(_Error value)? error, 392 | required TResult orElse(), 393 | }) { 394 | if (error != null) { 395 | return error(this); 396 | } 397 | return orElse(); 398 | } 399 | } 400 | 401 | abstract class _Error implements UserAuthStatus { 402 | const factory _Error() = _$_Error; 403 | } 404 | -------------------------------------------------------------------------------- /lib/presentation/features/authentication/auth_bloc/auth_event.freezed.dart: -------------------------------------------------------------------------------- 1 | // coverage:ignore-file 2 | // GENERATED CODE - DO NOT MODIFY BY HAND 3 | // ignore_for_file: type=lint 4 | // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target 5 | 6 | part of 'auth_event.dart'; 7 | 8 | // ************************************************************************** 9 | // FreezedGenerator 10 | // ************************************************************************** 11 | 12 | T _$identity(T value) => value; 13 | 14 | final _privateConstructorUsedError = UnsupportedError( 15 | 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); 16 | 17 | /// @nodoc 18 | mixin _$AuthEvent { 19 | @optionalTypeArgs 20 | TResult when({ 21 | required TResult Function() signInEvent, 22 | required TResult Function() signOutEvent, 23 | required TResult Function() checkForValidToken, 24 | }) => 25 | throw _privateConstructorUsedError; 26 | @optionalTypeArgs 27 | TResult? whenOrNull({ 28 | TResult? Function()? signInEvent, 29 | TResult? Function()? signOutEvent, 30 | TResult? Function()? checkForValidToken, 31 | }) => 32 | throw _privateConstructorUsedError; 33 | @optionalTypeArgs 34 | TResult maybeWhen({ 35 | TResult Function()? signInEvent, 36 | TResult Function()? signOutEvent, 37 | TResult Function()? checkForValidToken, 38 | required TResult orElse(), 39 | }) => 40 | throw _privateConstructorUsedError; 41 | @optionalTypeArgs 42 | TResult map({ 43 | required TResult Function(_SignInEvent value) signInEvent, 44 | required TResult Function(_SignOutEvent value) signOutEvent, 45 | required TResult Function(_CheckForValidToken value) checkForValidToken, 46 | }) => 47 | throw _privateConstructorUsedError; 48 | @optionalTypeArgs 49 | TResult? mapOrNull({ 50 | TResult? Function(_SignInEvent value)? signInEvent, 51 | TResult? Function(_SignOutEvent value)? signOutEvent, 52 | TResult? Function(_CheckForValidToken value)? checkForValidToken, 53 | }) => 54 | throw _privateConstructorUsedError; 55 | @optionalTypeArgs 56 | TResult maybeMap({ 57 | TResult Function(_SignInEvent value)? signInEvent, 58 | TResult Function(_SignOutEvent value)? signOutEvent, 59 | TResult Function(_CheckForValidToken value)? checkForValidToken, 60 | required TResult orElse(), 61 | }) => 62 | throw _privateConstructorUsedError; 63 | } 64 | 65 | /// @nodoc 66 | abstract class $AuthEventCopyWith<$Res> { 67 | factory $AuthEventCopyWith(AuthEvent value, $Res Function(AuthEvent) then) = 68 | _$AuthEventCopyWithImpl<$Res, AuthEvent>; 69 | } 70 | 71 | /// @nodoc 72 | class _$AuthEventCopyWithImpl<$Res, $Val extends AuthEvent> 73 | implements $AuthEventCopyWith<$Res> { 74 | _$AuthEventCopyWithImpl(this._value, this._then); 75 | 76 | // ignore: unused_field 77 | final $Val _value; 78 | // ignore: unused_field 79 | final $Res Function($Val) _then; 80 | } 81 | 82 | /// @nodoc 83 | abstract class _$$_SignInEventCopyWith<$Res> { 84 | factory _$$_SignInEventCopyWith( 85 | _$_SignInEvent value, $Res Function(_$_SignInEvent) then) = 86 | __$$_SignInEventCopyWithImpl<$Res>; 87 | } 88 | 89 | /// @nodoc 90 | class __$$_SignInEventCopyWithImpl<$Res> 91 | extends _$AuthEventCopyWithImpl<$Res, _$_SignInEvent> 92 | implements _$$_SignInEventCopyWith<$Res> { 93 | __$$_SignInEventCopyWithImpl( 94 | _$_SignInEvent _value, $Res Function(_$_SignInEvent) _then) 95 | : super(_value, _then); 96 | } 97 | 98 | /// @nodoc 99 | 100 | class _$_SignInEvent implements _SignInEvent { 101 | const _$_SignInEvent(); 102 | 103 | @override 104 | String toString() { 105 | return 'AuthEvent.signInEvent()'; 106 | } 107 | 108 | @override 109 | bool operator ==(dynamic other) { 110 | return identical(this, other) || 111 | (other.runtimeType == runtimeType && other is _$_SignInEvent); 112 | } 113 | 114 | @override 115 | int get hashCode => runtimeType.hashCode; 116 | 117 | @override 118 | @optionalTypeArgs 119 | TResult when({ 120 | required TResult Function() signInEvent, 121 | required TResult Function() signOutEvent, 122 | required TResult Function() checkForValidToken, 123 | }) { 124 | return signInEvent(); 125 | } 126 | 127 | @override 128 | @optionalTypeArgs 129 | TResult? whenOrNull({ 130 | TResult? Function()? signInEvent, 131 | TResult? Function()? signOutEvent, 132 | TResult? Function()? checkForValidToken, 133 | }) { 134 | return signInEvent?.call(); 135 | } 136 | 137 | @override 138 | @optionalTypeArgs 139 | TResult maybeWhen({ 140 | TResult Function()? signInEvent, 141 | TResult Function()? signOutEvent, 142 | TResult Function()? checkForValidToken, 143 | required TResult orElse(), 144 | }) { 145 | if (signInEvent != null) { 146 | return signInEvent(); 147 | } 148 | return orElse(); 149 | } 150 | 151 | @override 152 | @optionalTypeArgs 153 | TResult map({ 154 | required TResult Function(_SignInEvent value) signInEvent, 155 | required TResult Function(_SignOutEvent value) signOutEvent, 156 | required TResult Function(_CheckForValidToken value) checkForValidToken, 157 | }) { 158 | return signInEvent(this); 159 | } 160 | 161 | @override 162 | @optionalTypeArgs 163 | TResult? mapOrNull({ 164 | TResult? Function(_SignInEvent value)? signInEvent, 165 | TResult? Function(_SignOutEvent value)? signOutEvent, 166 | TResult? Function(_CheckForValidToken value)? checkForValidToken, 167 | }) { 168 | return signInEvent?.call(this); 169 | } 170 | 171 | @override 172 | @optionalTypeArgs 173 | TResult maybeMap({ 174 | TResult Function(_SignInEvent value)? signInEvent, 175 | TResult Function(_SignOutEvent value)? signOutEvent, 176 | TResult Function(_CheckForValidToken value)? checkForValidToken, 177 | required TResult orElse(), 178 | }) { 179 | if (signInEvent != null) { 180 | return signInEvent(this); 181 | } 182 | return orElse(); 183 | } 184 | } 185 | 186 | abstract class _SignInEvent implements AuthEvent { 187 | const factory _SignInEvent() = _$_SignInEvent; 188 | } 189 | 190 | /// @nodoc 191 | abstract class _$$_SignOutEventCopyWith<$Res> { 192 | factory _$$_SignOutEventCopyWith( 193 | _$_SignOutEvent value, $Res Function(_$_SignOutEvent) then) = 194 | __$$_SignOutEventCopyWithImpl<$Res>; 195 | } 196 | 197 | /// @nodoc 198 | class __$$_SignOutEventCopyWithImpl<$Res> 199 | extends _$AuthEventCopyWithImpl<$Res, _$_SignOutEvent> 200 | implements _$$_SignOutEventCopyWith<$Res> { 201 | __$$_SignOutEventCopyWithImpl( 202 | _$_SignOutEvent _value, $Res Function(_$_SignOutEvent) _then) 203 | : super(_value, _then); 204 | } 205 | 206 | /// @nodoc 207 | 208 | class _$_SignOutEvent implements _SignOutEvent { 209 | const _$_SignOutEvent(); 210 | 211 | @override 212 | String toString() { 213 | return 'AuthEvent.signOutEvent()'; 214 | } 215 | 216 | @override 217 | bool operator ==(dynamic other) { 218 | return identical(this, other) || 219 | (other.runtimeType == runtimeType && other is _$_SignOutEvent); 220 | } 221 | 222 | @override 223 | int get hashCode => runtimeType.hashCode; 224 | 225 | @override 226 | @optionalTypeArgs 227 | TResult when({ 228 | required TResult Function() signInEvent, 229 | required TResult Function() signOutEvent, 230 | required TResult Function() checkForValidToken, 231 | }) { 232 | return signOutEvent(); 233 | } 234 | 235 | @override 236 | @optionalTypeArgs 237 | TResult? whenOrNull({ 238 | TResult? Function()? signInEvent, 239 | TResult? Function()? signOutEvent, 240 | TResult? Function()? checkForValidToken, 241 | }) { 242 | return signOutEvent?.call(); 243 | } 244 | 245 | @override 246 | @optionalTypeArgs 247 | TResult maybeWhen({ 248 | TResult Function()? signInEvent, 249 | TResult Function()? signOutEvent, 250 | TResult Function()? checkForValidToken, 251 | required TResult orElse(), 252 | }) { 253 | if (signOutEvent != null) { 254 | return signOutEvent(); 255 | } 256 | return orElse(); 257 | } 258 | 259 | @override 260 | @optionalTypeArgs 261 | TResult map({ 262 | required TResult Function(_SignInEvent value) signInEvent, 263 | required TResult Function(_SignOutEvent value) signOutEvent, 264 | required TResult Function(_CheckForValidToken value) checkForValidToken, 265 | }) { 266 | return signOutEvent(this); 267 | } 268 | 269 | @override 270 | @optionalTypeArgs 271 | TResult? mapOrNull({ 272 | TResult? Function(_SignInEvent value)? signInEvent, 273 | TResult? Function(_SignOutEvent value)? signOutEvent, 274 | TResult? Function(_CheckForValidToken value)? checkForValidToken, 275 | }) { 276 | return signOutEvent?.call(this); 277 | } 278 | 279 | @override 280 | @optionalTypeArgs 281 | TResult maybeMap({ 282 | TResult Function(_SignInEvent value)? signInEvent, 283 | TResult Function(_SignOutEvent value)? signOutEvent, 284 | TResult Function(_CheckForValidToken value)? checkForValidToken, 285 | required TResult orElse(), 286 | }) { 287 | if (signOutEvent != null) { 288 | return signOutEvent(this); 289 | } 290 | return orElse(); 291 | } 292 | } 293 | 294 | abstract class _SignOutEvent implements AuthEvent { 295 | const factory _SignOutEvent() = _$_SignOutEvent; 296 | } 297 | 298 | /// @nodoc 299 | abstract class _$$_CheckForValidTokenCopyWith<$Res> { 300 | factory _$$_CheckForValidTokenCopyWith(_$_CheckForValidToken value, 301 | $Res Function(_$_CheckForValidToken) then) = 302 | __$$_CheckForValidTokenCopyWithImpl<$Res>; 303 | } 304 | 305 | /// @nodoc 306 | class __$$_CheckForValidTokenCopyWithImpl<$Res> 307 | extends _$AuthEventCopyWithImpl<$Res, _$_CheckForValidToken> 308 | implements _$$_CheckForValidTokenCopyWith<$Res> { 309 | __$$_CheckForValidTokenCopyWithImpl( 310 | _$_CheckForValidToken _value, $Res Function(_$_CheckForValidToken) _then) 311 | : super(_value, _then); 312 | } 313 | 314 | /// @nodoc 315 | 316 | class _$_CheckForValidToken implements _CheckForValidToken { 317 | const _$_CheckForValidToken(); 318 | 319 | @override 320 | String toString() { 321 | return 'AuthEvent.checkForValidToken()'; 322 | } 323 | 324 | @override 325 | bool operator ==(dynamic other) { 326 | return identical(this, other) || 327 | (other.runtimeType == runtimeType && other is _$_CheckForValidToken); 328 | } 329 | 330 | @override 331 | int get hashCode => runtimeType.hashCode; 332 | 333 | @override 334 | @optionalTypeArgs 335 | TResult when({ 336 | required TResult Function() signInEvent, 337 | required TResult Function() signOutEvent, 338 | required TResult Function() checkForValidToken, 339 | }) { 340 | return checkForValidToken(); 341 | } 342 | 343 | @override 344 | @optionalTypeArgs 345 | TResult? whenOrNull({ 346 | TResult? Function()? signInEvent, 347 | TResult? Function()? signOutEvent, 348 | TResult? Function()? checkForValidToken, 349 | }) { 350 | return checkForValidToken?.call(); 351 | } 352 | 353 | @override 354 | @optionalTypeArgs 355 | TResult maybeWhen({ 356 | TResult Function()? signInEvent, 357 | TResult Function()? signOutEvent, 358 | TResult Function()? checkForValidToken, 359 | required TResult orElse(), 360 | }) { 361 | if (checkForValidToken != null) { 362 | return checkForValidToken(); 363 | } 364 | return orElse(); 365 | } 366 | 367 | @override 368 | @optionalTypeArgs 369 | TResult map({ 370 | required TResult Function(_SignInEvent value) signInEvent, 371 | required TResult Function(_SignOutEvent value) signOutEvent, 372 | required TResult Function(_CheckForValidToken value) checkForValidToken, 373 | }) { 374 | return checkForValidToken(this); 375 | } 376 | 377 | @override 378 | @optionalTypeArgs 379 | TResult? mapOrNull({ 380 | TResult? Function(_SignInEvent value)? signInEvent, 381 | TResult? Function(_SignOutEvent value)? signOutEvent, 382 | TResult? Function(_CheckForValidToken value)? checkForValidToken, 383 | }) { 384 | return checkForValidToken?.call(this); 385 | } 386 | 387 | @override 388 | @optionalTypeArgs 389 | TResult maybeMap({ 390 | TResult Function(_SignInEvent value)? signInEvent, 391 | TResult Function(_SignOutEvent value)? signOutEvent, 392 | TResult Function(_CheckForValidToken value)? checkForValidToken, 393 | required TResult orElse(), 394 | }) { 395 | if (checkForValidToken != null) { 396 | return checkForValidToken(this); 397 | } 398 | return orElse(); 399 | } 400 | } 401 | 402 | abstract class _CheckForValidToken implements AuthEvent { 403 | const factory _CheckForValidToken() = _$_CheckForValidToken; 404 | } 405 | --------------------------------------------------------------------------------