├── ios ├── Flutter │ ├── Debug.xcconfig │ ├── Release.xcconfig │ └── AppFrameworkInfo.plist ├── Runner │ ├── Runner-Bridging-Header.h │ ├── Assets.xcassets │ │ ├── LaunchImage.imageset │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ ├── README.md │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ └── Contents.json │ ├── AppDelegate.swift │ ├── Base.lproj │ │ ├── Main.storyboard │ │ └── LaunchScreen.storyboard │ └── Info.plist ├── Runner.xcodeproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ └── IDEWorkspaceChecks.plist │ ├── xcshareddata │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ └── project.pbxproj ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── WorkspaceSettings.xcsettings │ │ └── IDEWorkspaceChecks.plist └── .gitignore ├── web ├── favicon.png ├── icons │ ├── Icon-192.png │ ├── Icon-512.png │ ├── Icon-maskable-192.png │ └── Icon-maskable-512.png ├── manifest.json └── index.html ├── 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 │ │ │ │ └── dev │ │ │ │ │ └── dacianflorea │ │ │ │ │ └── rxdart_state_management │ │ │ │ │ └── rxdart_state_management_article │ │ │ │ │ └── MainActivity.kt │ │ │ └── AndroidManifest.xml │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ └── profile │ │ │ └── AndroidManifest.xml │ └── build.gradle ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── .gitignore ├── settings.gradle └── build.gradle ├── lib ├── features │ └── universities_feed │ │ ├── domain │ │ ├── repository │ │ │ └── untiversities_repository.dart │ │ ├── entity │ │ │ └── university.dart │ │ └── usecase │ │ │ └── get_universities_by_country_use_case.dart │ │ ├── data │ │ ├── source │ │ │ ├── network │ │ │ │ ├── endpoint │ │ │ │ │ └── university_endpoint.dart │ │ │ │ └── model │ │ │ │ │ └── api_university_model.dart │ │ │ └── university_remote_data_source.dart │ │ └── repository │ │ │ └── university_repository_impl.dart │ │ └── presentation │ │ ├── models │ │ ├── university_screen_state.dart │ │ └── university_screen_model.dart │ │ └── screen │ │ ├── universities_view_model.dart │ │ ├── universities_screen.dart │ │ └── universities_screen_manual_subscription.dart ├── network_config │ ├── json_api_response.dart │ ├── app_result.dart │ ├── retrofit_client.dart │ ├── error_convertor.dart │ └── api_error.dart ├── main.dart ├── app.dart └── utils │ ├── extensions │ ├── iterable_extensions.dart │ ├── map_extensions.dart │ └── future_extensions.dart │ └── app_config.dart ├── test ├── widget_test │ └── widget_test.dart └── unit_test │ ├── universities_feed │ ├── presentation │ │ ├── model │ │ │ └── university_screen_model_test.dart │ │ └── screen │ │ │ └── universities_view_model_test.dart │ ├── data │ │ ├── repository │ │ │ └── universitiy_repository_impl_test.dart │ │ └── source │ │ │ └── network │ │ │ ├── model │ │ │ └── api_university_model_test.dart │ │ │ ├── university_remote_data_source_test.dart │ │ │ └── endpoint │ │ │ └── university_endpoint_test.dart │ └── domain │ │ └── usecase │ │ └── get_universities_by_country_use_case_test.dart │ ├── network_config │ ├── mock_interceptor │ │ └── dio_mock_responses_adapter.dart │ └── dio_error_convertor_test.dart │ └── extensions │ ├── future_extensions_test.dart │ ├── iterable_extensions_test.dart │ └── map_extensions_test.dart ├── .metadata ├── README.md ├── analysis_options.yaml ├── pubspec.yaml ├── .gitignore └── pubspec.lock /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dacianf/flutter_rxdart_state_management/HEAD/web/favicon.png -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dacianf/flutter_rxdart_state_management/HEAD/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dacianf/flutter_rxdart_state_management/HEAD/web/icons/Icon-512.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dacianf/flutter_rxdart_state_management/HEAD/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dacianf/flutter_rxdart_state_management/HEAD/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dacianf/flutter_rxdart_state_management/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/dacianf/flutter_rxdart_state_management/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/dacianf/flutter_rxdart_state_management/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dacianf/flutter_rxdart_state_management/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/dacianf/flutter_rxdart_state_management/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dacianf/flutter_rxdart_state_management/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dacianf/flutter_rxdart_state_management/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dacianf/flutter_rxdart_state_management/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dacianf/flutter_rxdart_state_management/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/dacianf/flutter_rxdart_state_management/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/dacianf/flutter_rxdart_state_management/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/dacianf/flutter_rxdart_state_management/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/dacianf/flutter_rxdart_state_management/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/dacianf/flutter_rxdart_state_management/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/dacianf/flutter_rxdart_state_management/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/dacianf/flutter_rxdart_state_management/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/dacianf/flutter_rxdart_state_management/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/dacianf/flutter_rxdart_state_management/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/dacianf/flutter_rxdart_state_management/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/dacianf/flutter_rxdart_state_management/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/dacianf/flutter_rxdart_state_management/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dacianf/flutter_rxdart_state_management/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/dacianf/flutter_rxdart_state_management/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip 7 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/dev/dacianflorea/rxdart_state_management/rxdart_state_management_article/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package dev.dacianflorea.rxdart_state_management.rxdart_state_management_article 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity : FlutterActivity() 6 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/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/features/universities_feed/domain/repository/untiversities_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:rxdart_state_management_article/features/universities_feed/domain/entity/university.dart'; 2 | import 'package:rxdart_state_management_article/network_config/app_result.dart'; 3 | 4 | abstract class UniversitiesRepository { 5 | Stream>> getUniversities(String? country); 6 | } 7 | -------------------------------------------------------------------------------- /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 4 | this directory. 5 | 6 | You can also do it by opening your Flutter project's Xcode project 7 | with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and 8 | dropping in the desired images. -------------------------------------------------------------------------------- /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 | 11 | 12 | -------------------------------------------------------------------------------- /lib/network_config/json_api_response.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'package:freezed_annotation/freezed_annotation.dart'; 3 | 4 | part 'json_api_response.freezed.dart'; 5 | 6 | part 'json_api_response.g.dart'; 7 | 8 | @freezed 9 | class JsonApiResponse with _$JsonApiResponse { 10 | factory JsonApiResponse({required Map json}) = 11 | _JsonApiResponse; 12 | 13 | factory JsonApiResponse.fromJson(Map json) => 14 | _$JsonApiResponseFromJson(json); 15 | } 16 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 11 | 12 | -------------------------------------------------------------------------------- /lib/features/universities_feed/domain/entity/university.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'package:freezed_annotation/freezed_annotation.dart'; 3 | 4 | part 'university.freezed.dart'; 5 | 6 | @freezed 7 | class University with _$University { 8 | factory University({ 9 | required String alphaCode, 10 | required String country, 11 | required String state, 12 | required String name, 13 | required List websites, 14 | required List domains, 15 | }) = _University; 16 | } 17 | -------------------------------------------------------------------------------- /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/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:logging/logging.dart'; 3 | import 'package:rxdart_state_management_article/app.dart'; 4 | import 'package:rxdart_state_management_article/utils/app_config.dart'; 5 | 6 | void main() { 7 | _setupLogging(); 8 | AppConfig.setEnvironment(Environment.dev); 9 | runApp(const MyApp()); 10 | } 11 | 12 | void _setupLogging() { 13 | Logger.root.level = Level.ALL; 14 | Logger.root.onRecord.listen((rec) { 15 | print('${rec.level.name}: ${rec.time}: ${rec.message}'); 16 | }); 17 | } 18 | -------------------------------------------------------------------------------- /lib/features/universities_feed/data/source/network/endpoint/university_endpoint.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:retrofit/retrofit.dart'; 3 | import 'package:rxdart_state_management_article/features/universities_feed/data/source/network/model/api_university_model.dart'; 4 | 5 | part 'university_endpoint.g.dart'; 6 | 7 | @RestApi() 8 | abstract class UniversityEndpoint { 9 | factory UniversityEndpoint(Dio dio, {String baseUrl}) = _UniversityEndpoint; 10 | 11 | @GET("/search") 12 | Future> getUniversitiesByCountry( 13 | @Query("country") String country); 14 | } 15 | -------------------------------------------------------------------------------- /lib/features/universities_feed/presentation/models/university_screen_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'package:freezed_annotation/freezed_annotation.dart'; 3 | import 'package:rxdart_state_management_article/features/universities_feed/presentation/models/university_screen_model.dart'; 4 | 5 | part 'university_screen_state.freezed.dart'; 6 | 7 | @freezed 8 | class UniversityScreenState with _$UniversityScreenState { 9 | const UniversityScreenState._(); 10 | 11 | factory UniversityScreenState({ 12 | required List universities, 13 | }) = _UniversityScreenState; 14 | } 15 | -------------------------------------------------------------------------------- /lib/app.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:rxdart_state_management_article/features/universities_feed/presentation/screen/universities_screen.dart'; 3 | 4 | class MyApp extends StatelessWidget { 5 | const MyApp({Key? key}) : super(key: key); 6 | 7 | // This widget is the root of your application. 8 | @override 9 | Widget build(BuildContext context) { 10 | return MaterialApp( 11 | title: 'Flutter Demo', 12 | theme: ThemeData( 13 | primarySwatch: Colors.blue, 14 | ), 15 | home: const UniversitiesScreen(), 16 | // home: const UniversitiesScreenManualSubscription(), 17 | ); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/features/universities_feed/presentation/models/university_screen_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'package:freezed_annotation/freezed_annotation.dart'; 3 | import 'package:rxdart_state_management_article/features/universities_feed/domain/entity/university.dart'; 4 | 5 | part 'university_screen_model.freezed.dart'; 6 | 7 | @freezed 8 | class UniversityScreenModel with _$UniversityScreenModel { 9 | const UniversityScreenModel._(); 10 | 11 | factory UniversityScreenModel({ 12 | required String country, 13 | required String name, 14 | required String website, 15 | }) = _UniversityScreenModel; 16 | 17 | factory UniversityScreenModel.fromDomain(University university) { 18 | return UniversityScreenModel( 19 | country: university.country, 20 | name: university.name, 21 | website: university.websites.first, 22 | ); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /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 | 9.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /lib/network_config/app_result.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'package:freezed_annotation/freezed_annotation.dart'; 3 | import 'package:rxdart_state_management_article/network_config/api_error.dart'; 4 | 5 | part 'app_result.freezed.dart'; 6 | 7 | @freezed 8 | class AppResult with _$AppResult { 9 | const AppResult._(); 10 | 11 | const factory AppResult.data(T value) = Data; 12 | 13 | const factory AppResult.loading() = Loading; 14 | 15 | const factory AppResult.appError([String? message]) = AppError; 16 | 17 | const factory AppResult.apiError(ApiError error) = AppResultApiError; 18 | 19 | AppResult safeMap(E Function(T) transform) { 20 | return when( 21 | data: (e) => AppResult.data(transform(e)), 22 | loading: () => const AppResult.loading(), 23 | appError: (e) => AppResult.appError(e), 24 | apiError: (e) => AppResult.apiError(e), 25 | ); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rxdart_state_management_article", 3 | "short_name": "rxdart_state_management_article", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /lib/features/universities_feed/data/repository/university_repository_impl.dart: -------------------------------------------------------------------------------- 1 | import 'package:rxdart_state_management_article/features/universities_feed/data/source/university_remote_data_source.dart'; 2 | import 'package:rxdart_state_management_article/features/universities_feed/domain/entity/university.dart'; 3 | import 'package:rxdart_state_management_article/features/universities_feed/domain/repository/untiversities_repository.dart'; 4 | import 'package:rxdart_state_management_article/network_config/app_result.dart'; 5 | 6 | class UniversityRepositoryImpl extends UniversitiesRepository { 7 | final UniversityRemoteDataSource _universityRemoteDataSource; 8 | 9 | UniversityRepositoryImpl( 10 | {UniversityRemoteDataSource? universityRemoteDataSource}) 11 | : _universityRemoteDataSource = 12 | universityRemoteDataSource ?? UniversityRemoteDataSource(); 13 | 14 | @override 15 | Stream>> getUniversities(String? country) { 16 | return _universityRemoteDataSource.getUniversitiesByCountry(country); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /test/widget_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 | void main() { 9 | // testWidgets('Counter increments smoke test', (WidgetTester tester) async { 10 | // // Build our app and trigger a frame. 11 | // await tester.pumpWidget(const MyApp()); 12 | // 13 | // // Verify that our counter starts at 0. 14 | // expect(find.text('0'), findsOneWidget); 15 | // expect(find.text('1'), findsNothing); 16 | // 17 | // // Tap the '+' icon and trigger a frame. 18 | // await tester.tap(find.byIcon(Icons.add)); 19 | // await tester.pump(); 20 | // 21 | // // Verify that our counter has incremented. 22 | // expect(find.text('0'), findsNothing); 23 | // expect(find.text('1'), findsOneWidget); 24 | // }); 25 | } 26 | -------------------------------------------------------------------------------- /lib/utils/extensions/iterable_extensions.dart: -------------------------------------------------------------------------------- 1 | import 'package:rxdart_state_management_article/utils/extensions/map_extensions.dart'; 2 | 3 | extension IterableExtensions on Iterable { 4 | bool hasSameElementsAs(Iterable? other) { 5 | if (other == null || other.length != length) return false; 6 | 7 | var currentIterator = iterator; 8 | var otherIterator = other.iterator; 9 | 10 | while (currentIterator.moveNext() && otherIterator.moveNext()) { 11 | if (currentIterator.current is Iterable) { 12 | if ((currentIterator.current as Iterable) 13 | .hasSameElementsAs(otherIterator.current as Iterable) == 14 | false) { 15 | return false; 16 | } 17 | } else if (currentIterator.current is Map) { 18 | if ((currentIterator.current as Map) 19 | .hasSameElementsAs(otherIterator.current as Map) == 20 | false) { 21 | return false; 22 | } 23 | } else if (currentIterator.current != otherIterator.current) { 24 | return false; 25 | } 26 | } 27 | return true; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/utils/extensions/map_extensions.dart: -------------------------------------------------------------------------------- 1 | import 'package:rxdart_state_management_article/utils/extensions/iterable_extensions.dart'; 2 | 3 | extension MapExtensions on Map { 4 | bool hasSameElementsAs(Map? other) { 5 | if (other == null || other.length != length) return false; 6 | 7 | var currentIterator = entries.iterator; 8 | while (currentIterator.moveNext()) { 9 | var currentValue = currentIterator.current; 10 | var otherValue = other[currentValue.key]; 11 | if (otherValue == null || 12 | otherValue.runtimeType != currentValue.value.runtimeType) { 13 | return false; 14 | } 15 | if (otherValue is Map) { 16 | if (!otherValue.hasSameElementsAs(currentValue.value as Map)) { 17 | return false; 18 | } 19 | } else if (otherValue is List) { 20 | if (!otherValue.hasSameElementsAs(currentValue.value as List)) { 21 | return false; 22 | } 23 | } else { 24 | if (otherValue != currentValue.value) { 25 | return false; 26 | } 27 | } 28 | } 29 | return true; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/features/universities_feed/data/source/university_remote_data_source.dart: -------------------------------------------------------------------------------- 1 | import 'package:rxdart_state_management_article/features/universities_feed/data/source/network/endpoint/university_endpoint.dart'; 2 | import 'package:rxdart_state_management_article/features/universities_feed/domain/entity/university.dart'; 3 | import 'package:rxdart_state_management_article/network_config/app_result.dart'; 4 | import 'package:rxdart_state_management_article/network_config/retrofit_client.dart'; 5 | import 'package:rxdart_state_management_article/utils/extensions/future_extensions.dart'; 6 | 7 | class UniversityRemoteDataSource { 8 | final UniversityEndpoint _universityEndpoint; 9 | 10 | UniversityRemoteDataSource({UniversityEndpoint? universityEndpoint}) 11 | : _universityEndpoint = universityEndpoint ?? 12 | UniversityEndpoint( 13 | DioClientExtension.createUniversitiesApiClient()); 14 | 15 | Stream>> getUniversitiesByCountry( 16 | String? country, 17 | ) { 18 | return _universityEndpoint 19 | .getUniversitiesByCountry(country ?? "United states") 20 | .safeApiConvert((p0) => p0.map((e) => e.toDomain()).toList()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /lib/utils/extensions/future_extensions.dart: -------------------------------------------------------------------------------- 1 | import 'package:rxdart/rxdart.dart'; 2 | import 'package:rxdart_state_management_article/network_config/api_error.dart'; 3 | import 'package:rxdart_state_management_article/network_config/app_result.dart'; 4 | 5 | extension FutureExtension on Future { 6 | Stream> safeApi() { 7 | return then((value) { 8 | return AppResult.data(value); 9 | }) 10 | .onError((error, stackTrace) { 11 | if (error is ApiError) { 12 | return AppResult.apiError(error); 13 | } 14 | return AppResult.appError(error.toString()); 15 | }) 16 | .asStream() 17 | .startWith(AppResult.loading()); 18 | } 19 | 20 | Stream> safeApiConvert(E Function(T) transform) { 21 | return then((value) { 22 | return AppResult.data(transform(value)); 23 | }) 24 | .onError((error, stackTrace) { 25 | if (error is ApiError) { 26 | return AppResult.apiError(error); 27 | } 28 | return AppResult.appError(error.toString()); 29 | }) 30 | .asStream() 31 | .startWith(AppResult.loading()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/features/universities_feed/presentation/screen/universities_view_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:rxdart/rxdart.dart'; 2 | import 'package:rxdart_state_management_article/features/universities_feed/domain/usecase/get_universities_by_country_use_case.dart'; 3 | import 'package:rxdart_state_management_article/features/universities_feed/presentation/models/university_screen_state.dart'; 4 | import 'package:rxdart_state_management_article/network_config/app_result.dart'; 5 | 6 | class UniversitiesViewModel { 7 | final GetUniversitiesByCountryUseCase _getUniversitiesByCountryUseCase; 8 | 9 | final Subject _searchByCountry = PublishSubject(); 10 | 11 | late Stream> universities; 12 | 13 | UniversitiesViewModel( 14 | {GetUniversitiesByCountryUseCase? getUniversitiesByCountryUseCase}) 15 | : _getUniversitiesByCountryUseCase = getUniversitiesByCountryUseCase ?? 16 | GetUniversitiesByCountryUseCase() { 17 | universities = _searchByCountry 18 | .startWith(null) 19 | .flatMap((value) => _getUniversitiesByCountryUseCase.invoke(value)); 20 | } 21 | 22 | void searchByCountry(String country) { 23 | _searchByCountry.add(country); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /lib/network_config/retrofit_client.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:logging/logging.dart'; 3 | import 'package:rxdart_state_management_article/network_config/error_convertor.dart'; 4 | import 'package:rxdart_state_management_article/utils/app_config.dart'; 5 | 6 | extension DioClientExtension on Dio { 7 | static Dio createUniversitiesApiClient({ 8 | contentType = "application/json", 9 | bool shouldRefreshToken = true, 10 | ApiAuthorization authorizationType = ApiAuthorization.none, 11 | }) { 12 | Map headers = { 13 | "Content-Type": contentType, 14 | "Accept": "application/json", 15 | }; 16 | Dio dio = Dio(BaseOptions( 17 | baseUrl: AppConfig.universitiesApiUrl, 18 | headers: headers, 19 | connectTimeout: 10000, 20 | receiveTimeout: 15000, 21 | sendTimeout: 15000, 22 | )); 23 | dio.interceptors.addAll([ 24 | LogInterceptor( 25 | responseBody: true, 26 | requestBody: true, 27 | logPrint: (text) { 28 | if (!AppConfig.isProduction) { 29 | Logger.root.log(Level.INFO, "${DateTime.now()}: $text"); 30 | } 31 | }), 32 | ErrorConverter(), 33 | ]); 34 | return dio; 35 | } 36 | } 37 | 38 | enum ApiAuthorization { none, basic, token } 39 | -------------------------------------------------------------------------------- /lib/features/universities_feed/domain/usecase/get_universities_by_country_use_case.dart: -------------------------------------------------------------------------------- 1 | import 'package:rxdart_state_management_article/features/universities_feed/data/repository/university_repository_impl.dart'; 2 | import 'package:rxdart_state_management_article/features/universities_feed/domain/repository/untiversities_repository.dart'; 3 | import 'package:rxdart_state_management_article/features/universities_feed/presentation/models/university_screen_model.dart'; 4 | import 'package:rxdart_state_management_article/features/universities_feed/presentation/models/university_screen_state.dart'; 5 | import 'package:rxdart_state_management_article/network_config/app_result.dart'; 6 | 7 | class GetUniversitiesByCountryUseCase { 8 | final UniversitiesRepository _universitiesRepository; 9 | 10 | GetUniversitiesByCountryUseCase( 11 | {UniversitiesRepository? universitiesRepository}) 12 | : _universitiesRepository = 13 | universitiesRepository ?? UniversityRepositoryImpl(); 14 | 15 | Stream> invoke(String? country) { 16 | return _universitiesRepository.getUniversities(country).map((event) { 17 | return event.safeMap((p0) => UniversityScreenState( 18 | universities: 19 | p0.map((e) => UniversityScreenModel.fromDomain(e)).toList(), 20 | )); 21 | }); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /.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: ee4e09cce01d6f2d7f4baebd247fde02e5008851 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: ee4e09cce01d6f2d7f4baebd247fde02e5008851 17 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 18 | - platform: android 19 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 20 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 21 | - platform: ios 22 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 23 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 24 | - platform: web 25 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 26 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 27 | 28 | # User provided section 29 | 30 | # List of Local paths (relative to this file) that should be 31 | # ignored by the migrate tool. 32 | # 33 | # Files that are not part of the templates will be ignored by default. 34 | unmanaged_files: 35 | - 'lib/main.dart' 36 | - 'ios/Runner.xcodeproj/project.pbxproj' 37 | -------------------------------------------------------------------------------- /lib/features/universities_feed/data/source/network/model/api_university_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'package:freezed_annotation/freezed_annotation.dart'; 3 | import 'package:rxdart_state_management_article/features/universities_feed/domain/entity/university.dart'; 4 | 5 | part 'api_university_model.freezed.dart'; 6 | part 'api_university_model.g.dart'; 7 | 8 | @freezed 9 | class ApiUniversityModel with _$ApiUniversityModel { 10 | const ApiUniversityModel._(); 11 | 12 | factory ApiUniversityModel({ 13 | @JsonKey(name: "alpha_two_code") String? alphaCode, 14 | @JsonKey(name: "country") String? country, 15 | @JsonKey(name: "state-province") String? state, 16 | @JsonKey(name: "name") String? name, 17 | @JsonKey(name: "web_pages") List? websites, 18 | @JsonKey(name: "domains") List? domains, 19 | }) = _ApiUniversityModel; 20 | 21 | factory ApiUniversityModel.fromJson(Map json) => 22 | _$ApiUniversityModelFromJson(json); 23 | 24 | University toDomain() { 25 | return University( 26 | alphaCode: alphaCode ?? "", 27 | country: country ?? "", 28 | state: state ?? "", 29 | name: name ?? "", 30 | websites: websites?.map((e) => e ?? "").toList() ?? [], 31 | domains: domains?.map((e) => e ?? "").toList() ?? [], 32 | ); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/network_config/error_convertor.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:dio/dio.dart'; 4 | import 'package:rxdart_state_management_article/network_config/api_error.dart'; 5 | 6 | class ErrorConverter extends InterceptorsWrapper { 7 | @override 8 | void onError(DioError err, ErrorInterceptorHandler handler) { 9 | if (err.type != DioErrorType.response) { 10 | handler.next(err); 11 | return; 12 | } 13 | Map errorBody = { 14 | "statusCode": -1, 15 | "message": "Something went wrong", 16 | }; 17 | errorBody["statusCode"] = err.response?.statusCode; 18 | var error = err.response?.data; 19 | Map errorResponse = {}; 20 | if (error is String) { 21 | try { 22 | errorResponse = (jsonDecode(error) as Map); 23 | } on Exception catch (err, _) { 24 | errorResponse = { 25 | "error": (error.isNotEmpty) ? error : errorBody["messsage"], 26 | }; 27 | } 28 | } else if (error is Map) { 29 | errorResponse = error; 30 | } 31 | 32 | errorBody["message"] = 33 | errorResponse["errorMessage"] ?? errorBody["message"]; 34 | if (errorResponse["errors"] is Map) { 35 | errorBody["errors"] = errorResponse["errors"]; 36 | } 37 | 38 | var apiError = ApiError.fromJson(errorBody); 39 | handler.next(err..error = apiError); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RxDart State Management Using MVVM With Clean Architecture and Unit Testing 2 | 3 | This project is a Flutter application that fetches and displays a list of universities with the help of an external API. The project also lets us filter the list by country. To make all this magic happen, we used clean and testable architecture to provide an easy-to-maintain and scalable code. 4 | 5 | ### Technologies Used: 6 | 7 | * MVVM and Clean Architecture pattern 8 | * RxDart for state management 9 | * Retrofit with Dio for the Network layer 10 | * Freezed and JsonSerializable for generating the models' boilerplates 11 | * Mockito for data mocking 12 | 13 | ### API Used: 14 | * [universities.hipolabs.com](http://universities.hipolabs.com/search) 15 | 16 | ### Related Reading by Dacian Florea: 17 | You can find me on [LinkedIn](https://www.linkedin.com/in/dacian-florea/) and [Toptal](https://www.toptal.com/resume/dacian-florea). 18 | 19 | * Clean architecture facilitates unit testing, which we demonstrate in the [Unit Testing in Flutter: From Workflow Essentials to Complex Scenarios](https://www.toptal.com/flutter/unit-testing-flutter) article published in the Toptal Engineering Blog. 20 | * RxDart combined MVVM with clean architecture facilitates state management in Flutter, as demonstrated in https://hackernoon.com/flutter-state-management-with-rxdart-streams. 21 | 22 | ## Getting Started 23 | 24 | Before running the app, you have to run: `flutter pub run build_runner build` 25 | -------------------------------------------------------------------------------- /lib/network_config/api_error.dart: -------------------------------------------------------------------------------- 1 | import 'package:freezed_annotation/freezed_annotation.dart'; 2 | import 'package:rxdart_state_management_article/utils/extensions/map_extensions.dart'; 3 | 4 | part 'api_error.g.dart'; 5 | 6 | @JsonSerializable() 7 | class ApiError extends Error { 8 | int statusCode; 9 | String message; 10 | Map? errors; 11 | 12 | ApiError({ 13 | required this.statusCode, 14 | required this.message, 15 | this.errors, 16 | }) : super(); 17 | 18 | factory ApiError.fromJson(Map json) => 19 | _$ApiErrorFromJson(json); 20 | 21 | ApiError copyWith({ 22 | int? statusCode, 23 | String? message, 24 | Map? errors, 25 | }) { 26 | return ApiError( 27 | statusCode: statusCode ?? this.statusCode, 28 | message: message ?? this.message, 29 | errors: errors ?? this.errors, 30 | ); 31 | } 32 | 33 | @override 34 | String toString() { 35 | return 'ApiError{statusCode: $statusCode, message: $message, errors: $errors}'; 36 | } 37 | 38 | @override 39 | bool operator ==(Object other) => 40 | identical(this, other) || 41 | other is ApiError && 42 | runtimeType == other.runtimeType && 43 | statusCode == other.statusCode && 44 | message == other.message && 45 | (errors?.hasSameElementsAs(other.errors) ?? errors == other.errors); 46 | 47 | @override 48 | int get hashCode => statusCode.hashCode ^ message.hashCode; 49 | } 50 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | analyzer: 13 | errors: 14 | invalid_annotation_target: ignore 15 | 16 | linter: 17 | # The lint rules applied to this project can be customized in the 18 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 19 | # included above or to enable additional rules. A list of all available lints 20 | # and their documentation is published at 21 | # https://dart-lang.github.io/linter/lints/index.html. 22 | # 23 | # Instead of disabling a lint rule for the entire project in the 24 | # section below, it can also be suppressed for a single line of code 25 | # or a specific dart file by using the `// ignore: name_of_lint` and 26 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 27 | # producing the lint. 28 | rules: 29 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 30 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 31 | 32 | # Additional information about this file can be found at 33 | # https://dart.dev/guides/language/analysis-options 34 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /test/unit_test/universities_feed/presentation/model/university_screen_model_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:rxdart_state_management_article/features/universities_feed/domain/entity/university.dart'; 3 | import 'package:rxdart_state_management_article/features/universities_feed/presentation/models/university_screen_model.dart'; 4 | 5 | void main() { 6 | University universityOne = University( 7 | alphaCode: "US", 8 | country: "United States", 9 | state: "", 10 | name: "Marywood University", 11 | websites: ["http://www.marywood.edu"], 12 | domains: ["marywood.edu"], 13 | ); 14 | 15 | University universityTwo = University( 16 | alphaCode: "US", 17 | country: "United States", 18 | state: "", 19 | name: "Lindenwood University", 20 | websites: ["http://www.lindenwood.edu/"], 21 | domains: ["lindenwood.edu"], 22 | ); 23 | UniversityScreenModel expectedUniversityScreenModelOne = 24 | UniversityScreenModel( 25 | country: "United States", 26 | name: "Marywood University", 27 | website: "http://www.marywood.edu", 28 | ); 29 | 30 | UniversityScreenModel expectedUniversityScreenModelTwo = 31 | UniversityScreenModel( 32 | country: "United States", 33 | name: "Lindenwood University", 34 | website: "http://www.lindenwood.edu/", 35 | ); 36 | 37 | group("Test UniversityScreenModel fromDomain", () { 38 | test('Test fromDomain using universityOne', () { 39 | expect(UniversityScreenModel.fromDomain(universityOne), 40 | expectedUniversityScreenModelOne); 41 | }); 42 | test('Test fromDomain using universityTwo', () { 43 | expect(UniversityScreenModel.fromDomain(universityTwo), 44 | expectedUniversityScreenModelTwo); 45 | }); 46 | }); 47 | } 48 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 16 | 20 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Rxdart State Management Article 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | rxdart_state_management_article 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 | 49 | 50 | -------------------------------------------------------------------------------- /test/unit_test/network_config/mock_interceptor/dio_mock_responses_adapter.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'dart:typed_data'; 3 | 4 | import 'package:dio/dio.dart'; 5 | import 'package:flutter_test/flutter_test.dart'; 6 | import 'package:rxdart_state_management_article/utils/extensions/map_extensions.dart'; 7 | 8 | class DioMockResponsesAdapter extends HttpClientAdapter { 9 | final MockAdapterInterceptor interceptor; 10 | 11 | DioMockResponsesAdapter(this.interceptor); 12 | 13 | @override 14 | void close({bool force = false}) {} 15 | 16 | @override 17 | Future fetch(RequestOptions options, 18 | Stream? requestStream, Future? cancelFuture) { 19 | if (options.method == interceptor.type.name.toUpperCase() && 20 | options.baseUrl == interceptor.uri && 21 | options.queryParameters.hasSameElementsAs(interceptor.query) && 22 | options.path == interceptor.path) { 23 | return Future.value(ResponseBody.fromString( 24 | jsonEncode(interceptor.serializableResponse), 25 | interceptor.responseCode, 26 | headers: { 27 | "content-type": ["application/json"] 28 | }, 29 | )); 30 | } 31 | return Future.value(ResponseBody.fromString( 32 | jsonEncode( 33 | {"error": "Request doesn't match the mock interceptor details!"}), 34 | -1, 35 | statusMessage: "Request doesn't match the mock interceptor details!")); 36 | } 37 | } 38 | 39 | enum RequestType { GET, POST, PUT, PATCH, DELETE } 40 | 41 | class MockAdapterInterceptor { 42 | final RequestType type; 43 | final String uri; 44 | final String path; 45 | final Map query; 46 | final Object serializableResponse; 47 | final int responseCode; 48 | 49 | MockAdapterInterceptor(this.type, this.uri, this.path, this.query, 50 | this.serializableResponse, this.responseCode); 51 | } 52 | -------------------------------------------------------------------------------- /lib/utils/app_config.dart: -------------------------------------------------------------------------------- 1 | enum Environment { dev, prod } 2 | 3 | extension EnvironmentExtensions on Environment { 4 | static Environment fromString(String string) { 5 | switch (string) { 6 | case "dev": 7 | return Environment.dev; 8 | case "prod": 9 | return Environment.prod; 10 | default: 11 | return Environment.dev; 12 | } 13 | } 14 | 15 | String get value { 16 | switch (this) { 17 | case Environment.dev: 18 | return "dev"; 19 | case Environment.prod: 20 | return "prod"; 21 | default: 22 | return "dev"; 23 | } 24 | } 25 | 26 | static String get key => "EnvironmentKey"; 27 | } 28 | 29 | class AppConfig { 30 | static Map _config = {}; 31 | 32 | static void setEnvironment(Environment env) { 33 | switch (env) { 34 | case Environment.dev: 35 | _config = _Config.debugConstants; 36 | break; 37 | case Environment.prod: 38 | _config = _Config.prodConstants; 39 | break; 40 | } 41 | } 42 | 43 | static bool get isProduction { 44 | return env == Environment.prod; 45 | } 46 | 47 | static String get universitiesApiUrl { 48 | return _config[_Config.universitiesApiUrl]; 49 | } 50 | 51 | static Environment get env { 52 | switch (_config[_Config.envKey]) { 53 | case "dev": 54 | return Environment.dev; 55 | case "prod": 56 | return Environment.prod; 57 | default: 58 | return Environment.dev; 59 | } 60 | } 61 | } 62 | 63 | class _Config { 64 | static const String envKey = "ENV_KEY"; 65 | static const String universitiesApiUrl = "UNIVERSITIES_API_URL"; 66 | 67 | static Map debugConstants = { 68 | envKey: "dev", 69 | universitiesApiUrl: "http://universities.hipolabs.com", 70 | }; 71 | 72 | static Map prodConstants = { 73 | envKey: "prod", 74 | universitiesApiUrl: "http://universities.hipolabs.com", 75 | }; 76 | } 77 | -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | rxdart_state_management_article 33 | 34 | 35 | 41 | 42 | 43 | 44 | 45 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 "dev.dacianflorea.rxdart_state_management.rxdart_state_management_article" 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 | -------------------------------------------------------------------------------- /test/unit_test/extensions/future_extensions_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:rxdart_state_management_article/network_config/api_error.dart'; 3 | import 'package:rxdart_state_management_article/network_config/app_result.dart'; 4 | import 'package:rxdart_state_management_article/utils/extensions/future_extensions.dart'; 5 | 6 | void main() { 7 | group("Test safeApi extension", () { 8 | test('Test Future emits data', () { 9 | expect( 10 | Future.value("Test").safeApi(), 11 | emitsInOrder([ 12 | const AppResult.loading(), 13 | const AppResult.data("Test"), 14 | ]), 15 | ); 16 | }); 17 | 18 | test('Test Future emits appError', () { 19 | expect( 20 | Future.error(Exception("ERROR")).safeApi(), 21 | emitsInOrder([ 22 | const AppResult.loading(), 23 | AppResult.appError(Exception("ERROR").toString()), 24 | ]), 25 | ); 26 | }); 27 | 28 | test('Test Future emits apiError from ApiError', () { 29 | ApiError apiError = 30 | ApiError(statusCode: 500, message: "Internal Server Error!"); 31 | expect( 32 | Future.error(apiError).safeApi(), 33 | emitsInOrder([ 34 | const AppResult.loading(), 35 | AppResult.apiError(apiError), 36 | ]), 37 | ); 38 | }); 39 | }); 40 | 41 | group("Test safeApiConvert extension", () { 42 | String converter(int value) { 43 | return value.toString(); 44 | } 45 | 46 | test('Test Future emits data', () { 47 | expect( 48 | Future.value(1).safeApiConvert(converter), 49 | emitsInOrder([ 50 | const AppResult.loading(), 51 | const AppResult.data("1"), 52 | ]), 53 | ); 54 | }); 55 | 56 | test('Test Future emits appError', () { 57 | expect( 58 | Future.error(Exception("ERROR")).safeApiConvert(converter), 59 | emitsInOrder([ 60 | const AppResult.loading(), 61 | AppResult.appError(Exception("ERROR").toString()), 62 | ]), 63 | ); 64 | }); 65 | 66 | test('Test Future emits apiError from ApiError', () { 67 | ApiError apiError = 68 | ApiError(statusCode: 500, message: "Internal Server Error!"); 69 | expect( 70 | Future.error(apiError).safeApiConvert(converter), 71 | emitsInOrder([ 72 | const AppResult.loading(), 73 | AppResult.apiError(apiError), 74 | ]), 75 | ); 76 | }); 77 | }); 78 | } 79 | -------------------------------------------------------------------------------- /test/unit_test/universities_feed/data/repository/universitiy_repository_impl_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:mockito/annotations.dart'; 3 | import 'package:mockito/mockito.dart'; 4 | import 'package:rxdart_state_management_article/features/universities_feed/data/repository/university_repository_impl.dart'; 5 | import 'package:rxdart_state_management_article/features/universities_feed/data/source/university_remote_data_source.dart'; 6 | import 'package:rxdart_state_management_article/features/universities_feed/domain/entity/university.dart'; 7 | import 'package:rxdart_state_management_article/features/universities_feed/domain/repository/untiversities_repository.dart'; 8 | import 'package:rxdart_state_management_article/network_config/app_result.dart'; 9 | 10 | import 'universitiy_repository_impl_test.mocks.dart'; 11 | 12 | @GenerateMocks([UniversityRemoteDataSource]) 13 | void main() { 14 | late UniversityRemoteDataSource dataSource; 15 | late UniversitiesRepository repo; 16 | 17 | group("Test function calls", () { 18 | setUp(() { 19 | dataSource = MockUniversityRemoteDataSource(); 20 | repo = UniversityRepositoryImpl(universityRemoteDataSource: dataSource); 21 | }); 22 | 23 | test('Test repo calls getUniversitiesByCountry from data source', () { 24 | when(dataSource.getUniversitiesByCountry(null)).thenAnswer( 25 | (realInvocation) => Stream.value(const AppResult.data([]))); 26 | 27 | repo.getUniversities(null); 28 | verify(dataSource.getUniversitiesByCountry(null)); 29 | }); 30 | 31 | test( 32 | 'Test repo calls getUniversitiesByCountry from data source and gets error', 33 | () { 34 | when(dataSource.getUniversitiesByCountry(null)).thenAnswer( 35 | (realInvocation) => Stream.value(const AppResult.appError("ERROR"))); 36 | 37 | expect( 38 | repo.getUniversities(null), 39 | emits(const AppResult>.appError("ERROR")), 40 | ); 41 | }); 42 | 43 | test( 44 | 'Test repo calls getUniversitiesByCountry from data source and gets data', 45 | () { 46 | University university = University( 47 | alphaCode: "alphaCode", 48 | country: "country", 49 | state: "state", 50 | name: "name", 51 | websites: ["websites"], 52 | domains: ["domains"]); 53 | 54 | when(dataSource.getUniversitiesByCountry(null)).thenAnswer( 55 | (realInvocation) => Stream.value(AppResult.data([university]))); 56 | 57 | expect( 58 | repo.getUniversities(null), 59 | emits(AppResult.data([university.copyWith()])), 60 | ); 61 | }); 62 | }); 63 | } 64 | -------------------------------------------------------------------------------- /test/unit_test/extensions/iterable_extensions_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:rxdart_state_management_article/utils/extensions/iterable_extensions.dart'; 3 | 4 | void main() { 5 | group("Test hasSameElementsAs extension", () { 6 | List listWithInts = List.generate(10, (index) => index); 7 | 8 | List listWithStrings = 9 | List.generate(10, (index) => index.toString()); 10 | 11 | List> listWithListOfStrings = List.generate( 12 | 10, (index1) => List.generate(5, (index2) => "$index1-$index2")); 13 | 14 | List>> listWithListOfListOfStrings = List.generate( 15 | 10, 16 | (index1) => List.generate( 17 | 5, 18 | (index2) => List.generate(3, (index3) => "$index1-$index2-$index3"), 19 | ), 20 | ); 21 | 22 | List>> listWithListOfListOfMapOfStringAndInt = 23 | List.generate( 24 | 10, 25 | (index1) => List.generate( 26 | 5, 27 | (index2) => Map.fromEntries(List.generate( 28 | 3, (index3) => MapEntry("$index1-$index2-$index3", index3))), 29 | ), 30 | ); 31 | 32 | test('Test hasSameElementsAs on null', () { 33 | expect( 34 | listWithInts.hasSameElementsAs(null), 35 | false, 36 | ); 37 | }); 38 | 39 | test('Test hasSameElementsAs on null', () { 40 | expect( 41 | listWithInts.hasSameElementsAs([]), 42 | false, 43 | ); 44 | }); 45 | 46 | test('Test hasSameElementsAs on list with ints', () { 47 | expect( 48 | listWithInts.hasSameElementsAs(List.of(listWithInts)), 49 | true, 50 | ); 51 | }); 52 | 53 | test('Test hasSameElementsAs on list with strings', () { 54 | expect( 55 | listWithStrings.hasSameElementsAs(List.of(listWithStrings)), 56 | true, 57 | ); 58 | }); 59 | 60 | test('Test hasSameElementsAs on list with list of strings', () { 61 | expect( 62 | listWithListOfStrings.hasSameElementsAs(List.of(listWithListOfStrings)), 63 | true, 64 | ); 65 | }); 66 | 67 | test('Test hasSameElementsAs on list with list of list of strings', () { 68 | expect( 69 | listWithListOfListOfStrings 70 | .hasSameElementsAs(List.of(listWithListOfListOfStrings)), 71 | true, 72 | ); 73 | }); 74 | 75 | test('Test hasSameElementsAs on list with list of map of strings and ints', 76 | () { 77 | expect( 78 | listWithListOfListOfMapOfStringAndInt 79 | .hasSameElementsAs(List.of(listWithListOfListOfMapOfStringAndInt)), 80 | true, 81 | ); 82 | }); 83 | }); 84 | } 85 | -------------------------------------------------------------------------------- /test/unit_test/universities_feed/data/source/network/model/api_university_model_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:rxdart_state_management_article/features/universities_feed/data/source/network/model/api_university_model.dart'; 3 | import 'package:rxdart_state_management_article/features/universities_feed/domain/entity/university.dart'; 4 | 5 | void main() { 6 | Map apiUniversityOneAsJson = { 7 | "alpha_two_code": "US", 8 | "domains": ["marywood.edu"], 9 | "country": "United States", 10 | "state-province": null, 11 | "web_pages": ["http://www.marywood.edu"], 12 | "name": "Marywood University" 13 | }; 14 | ApiUniversityModel expectedApiUniversityOne = ApiUniversityModel( 15 | alphaCode: "US", 16 | country: "United States", 17 | state: null, 18 | name: "Marywood University", 19 | websites: ["http://www.marywood.edu"], 20 | domains: ["marywood.edu"], 21 | ); 22 | University expectedUniversityOne = University( 23 | alphaCode: "US", 24 | country: "United States", 25 | state: "", 26 | name: "Marywood University", 27 | websites: ["http://www.marywood.edu"], 28 | domains: ["marywood.edu"], 29 | ); 30 | 31 | Map apiUniversityTwoAsJson = { 32 | "alpha_two_code": "US", 33 | "domains": ["lindenwood.edu"], 34 | "country": "United States", 35 | "state-province": "MJ", 36 | "web_pages": null, 37 | "name": "Lindenwood University" 38 | }; 39 | ApiUniversityModel expectedApiUniversityTwo = ApiUniversityModel( 40 | alphaCode: "US", 41 | country: "United States", 42 | state: "MJ", 43 | name: "Lindenwood University", 44 | websites: null, 45 | domains: ["lindenwood.edu"], 46 | ); 47 | University expectedUniversityTwo = University( 48 | alphaCode: "US", 49 | country: "United States", 50 | state: "MJ", 51 | name: "Lindenwood University", 52 | websites: [], 53 | domains: ["lindenwood.edu"], 54 | ); 55 | 56 | group("Test ApiUniversityModel initialization from json", () { 57 | test('Test using json one', () { 58 | expect(ApiUniversityModel.fromJson(apiUniversityOneAsJson), 59 | expectedApiUniversityOne); 60 | }); 61 | test('Test using json two', () { 62 | expect(ApiUniversityModel.fromJson(apiUniversityTwoAsJson), 63 | expectedApiUniversityTwo); 64 | }); 65 | }); 66 | 67 | group("Test ApiUniversityModel toDomain", () { 68 | test('Test toDomain using json one', () { 69 | expect(ApiUniversityModel.fromJson(apiUniversityOneAsJson).toDomain(), 70 | expectedUniversityOne); 71 | }); 72 | test('Test toDomain using json two', () { 73 | expect(ApiUniversityModel.fromJson(apiUniversityTwoAsJson).toDomain(), 74 | expectedUniversityTwo); 75 | }); 76 | }); 77 | } 78 | -------------------------------------------------------------------------------- /test/unit_test/universities_feed/data/source/network/university_remote_data_source_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:mockito/annotations.dart'; 3 | import 'package:mockito/mockito.dart'; 4 | import 'package:rxdart_state_management_article/features/universities_feed/data/source/network/endpoint/university_endpoint.dart'; 5 | import 'package:rxdart_state_management_article/features/universities_feed/data/source/network/model/api_university_model.dart'; 6 | import 'package:rxdart_state_management_article/features/universities_feed/data/source/university_remote_data_source.dart'; 7 | import 'package:rxdart_state_management_article/features/universities_feed/domain/entity/university.dart'; 8 | import 'package:rxdart_state_management_article/network_config/api_error.dart'; 9 | import 'package:rxdart_state_management_article/network_config/app_result.dart'; 10 | 11 | import 'university_remote_data_source_test.mocks.dart'; 12 | 13 | @GenerateMocks([UniversityEndpoint]) 14 | void main() { 15 | late UniversityEndpoint endpoint; 16 | late UniversityRemoteDataSource dataSource; 17 | 18 | group("Test function calls", () { 19 | setUp(() { 20 | endpoint = MockUniversityEndpoint(); 21 | dataSource = UniversityRemoteDataSource(universityEndpoint: endpoint); 22 | }); 23 | 24 | test('Test dataSource calls getUniversitiesByCountry from endpoint', () { 25 | when(endpoint.getUniversitiesByCountry("test")) 26 | .thenAnswer((realInvocation) => Future.value([])); 27 | 28 | dataSource.getUniversitiesByCountry("test"); 29 | verify(endpoint.getUniversitiesByCountry("test")); 30 | }); 31 | 32 | test('Test dataSource maps getUniversitiesByCountry response to Stream', 33 | () { 34 | when(endpoint.getUniversitiesByCountry("test")) 35 | .thenAnswer((realInvocation) => Future.value([])); 36 | 37 | expect( 38 | dataSource.getUniversitiesByCountry("test"), 39 | emitsInOrder([ 40 | const AppResult>.loading(), 41 | const AppResult>.data([]) 42 | ]), 43 | ); 44 | }); 45 | 46 | test( 47 | 'Test dataSource maps getUniversitiesByCountry response to Stream with error', 48 | () { 49 | ApiError mockApiError = ApiError( 50 | statusCode: 400, 51 | message: "error", 52 | errors: null, 53 | ); 54 | when(endpoint.getUniversitiesByCountry("test")) 55 | .thenAnswer((realInvocation) => Future.error(mockApiError)); 56 | 57 | expect( 58 | dataSource.getUniversitiesByCountry("test"), 59 | emitsInOrder([ 60 | const AppResult>.loading(), 61 | AppResult>.apiError(mockApiError) 62 | ]), 63 | ); 64 | }); 65 | }); 66 | } 67 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "size": "20x20", 5 | "idiom": "iphone", 6 | "filename": "Icon-App-20x20@2x.png", 7 | "scale": "2x" 8 | }, 9 | { 10 | "size": "20x20", 11 | "idiom": "iphone", 12 | "filename": "Icon-App-20x20@3x.png", 13 | "scale": "3x" 14 | }, 15 | { 16 | "size": "29x29", 17 | "idiom": "iphone", 18 | "filename": "Icon-App-29x29@1x.png", 19 | "scale": "1x" 20 | }, 21 | { 22 | "size": "29x29", 23 | "idiom": "iphone", 24 | "filename": "Icon-App-29x29@2x.png", 25 | "scale": "2x" 26 | }, 27 | { 28 | "size": "29x29", 29 | "idiom": "iphone", 30 | "filename": "Icon-App-29x29@3x.png", 31 | "scale": "3x" 32 | }, 33 | { 34 | "size": "40x40", 35 | "idiom": "iphone", 36 | "filename": "Icon-App-40x40@2x.png", 37 | "scale": "2x" 38 | }, 39 | { 40 | "size": "40x40", 41 | "idiom": "iphone", 42 | "filename": "Icon-App-40x40@3x.png", 43 | "scale": "3x" 44 | }, 45 | { 46 | "size": "60x60", 47 | "idiom": "iphone", 48 | "filename": "Icon-App-60x60@2x.png", 49 | "scale": "2x" 50 | }, 51 | { 52 | "size": "60x60", 53 | "idiom": "iphone", 54 | "filename": "Icon-App-60x60@3x.png", 55 | "scale": "3x" 56 | }, 57 | { 58 | "size": "20x20", 59 | "idiom": "ipad", 60 | "filename": "Icon-App-20x20@1x.png", 61 | "scale": "1x" 62 | }, 63 | { 64 | "size": "20x20", 65 | "idiom": "ipad", 66 | "filename": "Icon-App-20x20@2x.png", 67 | "scale": "2x" 68 | }, 69 | { 70 | "size": "29x29", 71 | "idiom": "ipad", 72 | "filename": "Icon-App-29x29@1x.png", 73 | "scale": "1x" 74 | }, 75 | { 76 | "size": "29x29", 77 | "idiom": "ipad", 78 | "filename": "Icon-App-29x29@2x.png", 79 | "scale": "2x" 80 | }, 81 | { 82 | "size": "40x40", 83 | "idiom": "ipad", 84 | "filename": "Icon-App-40x40@1x.png", 85 | "scale": "1x" 86 | }, 87 | { 88 | "size": "40x40", 89 | "idiom": "ipad", 90 | "filename": "Icon-App-40x40@2x.png", 91 | "scale": "2x" 92 | }, 93 | { 94 | "size": "76x76", 95 | "idiom": "ipad", 96 | "filename": "Icon-App-76x76@1x.png", 97 | "scale": "1x" 98 | }, 99 | { 100 | "size": "76x76", 101 | "idiom": "ipad", 102 | "filename": "Icon-App-76x76@2x.png", 103 | "scale": "2x" 104 | }, 105 | { 106 | "size": "83.5x83.5", 107 | "idiom": "ipad", 108 | "filename": "Icon-App-83.5x83.5@2x.png", 109 | "scale": "2x" 110 | }, 111 | { 112 | "size": "1024x1024", 113 | "idiom": "ios-marketing", 114 | "filename": "Icon-App-1024x1024@1x.png", 115 | "scale": "1x" 116 | } 117 | ], 118 | "info": { 119 | "version": 1, 120 | "author": "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /lib/features/universities_feed/presentation/screen/universities_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:rxdart_state_management_article/features/universities_feed/presentation/models/university_screen_model.dart'; 3 | import 'package:rxdart_state_management_article/features/universities_feed/presentation/models/university_screen_state.dart'; 4 | import 'package:rxdart_state_management_article/features/universities_feed/presentation/screen/universities_view_model.dart'; 5 | import 'package:rxdart_state_management_article/network_config/app_result.dart'; 6 | 7 | class UniversitiesScreen extends StatefulWidget { 8 | const UniversitiesScreen({Key? key}) : super(key: key); 9 | 10 | @override 11 | State createState() => _UniversitiesScreenState(); 12 | } 13 | 14 | class _UniversitiesScreenState extends State { 15 | final UniversitiesViewModel _viewModel = UniversitiesViewModel(); 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | return Scaffold( 20 | appBar: AppBar( 21 | title: const Text("RxDart State"), 22 | ), 23 | body: Column( 24 | children: [ 25 | Container( 26 | margin: const EdgeInsets.all(10), 27 | child: TextField( 28 | onChanged: _viewModel.searchByCountry, 29 | decoration: const InputDecoration( 30 | labelText: 'Search', suffixIcon: Icon(Icons.search)), 31 | ), 32 | ), 33 | Expanded( 34 | child: StreamBuilder( 35 | stream: _viewModel.universities, 36 | builder: (BuildContext context, 37 | AsyncSnapshot> snapshot) { 38 | return snapshot.data?.when( 39 | data: (e) => _buildUniversities(e.universities), 40 | loading: () => _buildLoading(), 41 | appError: (e) => _buildError(e.toString()), 42 | apiError: (e) => _buildError(e.toString())) ?? 43 | _buildLoading(); 44 | }, 45 | ), 46 | ), 47 | ], 48 | ), 49 | ); 50 | } 51 | 52 | Widget _buildUniversities(List universities) { 53 | return ListView.builder( 54 | itemCount: universities.length, 55 | itemBuilder: (BuildContext context, int index) { 56 | return Card( 57 | elevation: 5, 58 | margin: const EdgeInsets.all(10), 59 | child: Container( 60 | padding: const EdgeInsets.all(25), 61 | child: Column( 62 | children: [ 63 | Text("Name: ${universities[index].name}"), 64 | Text("Country: ${universities[index].country}"), 65 | Text("Website: ${universities[index].website}"), 66 | ], 67 | ), 68 | ), 69 | ); 70 | }, 71 | ); 72 | } 73 | 74 | Widget _buildLoading() { 75 | return const Center( 76 | child: CircularProgressIndicator(), 77 | ); 78 | } 79 | 80 | Widget _buildError(String error) { 81 | return Center( 82 | child: Text( 83 | error, 84 | style: 85 | Theme.of(context).textTheme.headline3?.copyWith(color: Colors.red), 86 | ), 87 | ); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /test/unit_test/network_config/dio_error_convertor_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | import 'package:rxdart_state_management_article/network_config/api_error.dart'; 4 | import 'package:rxdart_state_management_article/network_config/error_convertor.dart'; 5 | 6 | import 'mock_interceptor/dio_mock_responses_adapter.dart'; 7 | 8 | void main() { 9 | late Dio dioClient; 10 | late String baseUrl; 11 | 12 | DioMockResponsesAdapter _createMockAdapterForSearchRequest( 13 | int responseCode, Object responseBody) { 14 | return DioMockResponsesAdapter(MockAdapterInterceptor( 15 | RequestType.GET, 16 | baseUrl, 17 | "/test", 18 | {}, 19 | responseBody, 20 | responseCode, 21 | )); 22 | } 23 | 24 | RequestOptions getRequestOptions() { 25 | const _extra = {}; 26 | final queryParameters = {}; 27 | final _headers = {}; 28 | final _data = {}; 29 | return Options(method: 'GET', headers: _headers, extra: _extra) 30 | .compose(dioClient.options, '/test', 31 | queryParameters: queryParameters, data: _data) 32 | .copyWith(baseUrl: dioClient.options.baseUrl); 33 | } 34 | 35 | group("Test Dio Error Convertor", () { 36 | setUp(() { 37 | baseUrl = "https://test.url"; 38 | dioClient = Dio(BaseOptions(baseUrl: baseUrl)); 39 | dioClient.interceptors.add(ErrorConverter()); 40 | }); 41 | 42 | test('Test endpoint returns 404 error with error message', () async { 43 | dioClient.httpClientAdapter = _createMockAdapterForSearchRequest( 44 | 404, 45 | {"errorMessage": "Not found!"}, 46 | ); 47 | ApiError? apiError; 48 | try { 49 | await dioClient.fetch(getRequestOptions()); 50 | } on DioError catch (dioError, _) { 51 | expect(dioError.error.runtimeType, ApiError); 52 | apiError = dioError.error; 53 | } 54 | expect(apiError, ApiError(statusCode: 404, message: "Not found!")); 55 | }); 56 | 57 | test('Test endpoint returns 404 error with no error message', () async { 58 | dioClient.httpClientAdapter = _createMockAdapterForSearchRequest( 59 | 404, 60 | {}, 61 | ); 62 | ApiError? apiError; 63 | try { 64 | await dioClient.fetch(getRequestOptions()); 65 | } on DioError catch (dioError, _) { 66 | expect(dioError.error.runtimeType, ApiError); 67 | apiError = dioError.error; 68 | } 69 | expect( 70 | apiError, ApiError(statusCode: 404, message: "Something went wrong")); 71 | }); 72 | 73 | test('Test endpoint returns 400 error with List of errors', () async { 74 | dioClient.httpClientAdapter = _createMockAdapterForSearchRequest( 75 | 400, 76 | { 77 | "errorMessage": "Incorrect fields!", 78 | "errors": { 79 | "emailField": "Email is invalid", 80 | "passwordField": "Password is too short", 81 | }, 82 | }, 83 | ); 84 | ApiError? apiError; 85 | try { 86 | await dioClient.fetch(getRequestOptions()); 87 | } on DioError catch (dioError, _) { 88 | expect(dioError.error.runtimeType, ApiError); 89 | apiError = dioError.error; 90 | } 91 | expect( 92 | apiError, 93 | ApiError( 94 | statusCode: 400, 95 | message: "Incorrect fields!", 96 | errors: { 97 | "emailField": "Email is invalid", 98 | "passwordField": "Password is too short", 99 | }, 100 | )); 101 | }); 102 | }); 103 | } 104 | -------------------------------------------------------------------------------- /lib/features/universities_feed/presentation/screen/universities_screen_manual_subscription.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:rxdart/rxdart.dart'; 3 | import 'package:rxdart_state_management_article/features/universities_feed/presentation/models/university_screen_model.dart'; 4 | import 'package:rxdart_state_management_article/features/universities_feed/presentation/models/university_screen_state.dart'; 5 | import 'package:rxdart_state_management_article/features/universities_feed/presentation/screen/universities_view_model.dart'; 6 | import 'package:rxdart_state_management_article/network_config/app_result.dart'; 7 | 8 | class UniversitiesScreenManualSubscription extends StatefulWidget { 9 | const UniversitiesScreenManualSubscription({Key? key}) : super(key: key); 10 | 11 | @override 12 | State createState() => 13 | _UniversitiesScreenManualSubscriptionState(); 14 | } 15 | 16 | class _UniversitiesScreenManualSubscriptionState 17 | extends State { 18 | final UniversitiesViewModel _viewModel = UniversitiesViewModel(); 19 | final CompositeSubscription _subscriptions = CompositeSubscription(); 20 | 21 | AppResult _screenState = const AppResult.loading(); 22 | 23 | @override 24 | void initState() { 25 | super.initState(); 26 | _subscriptions.add(_viewModel.universities.listen((event) { 27 | setState(() { 28 | _screenState = event; 29 | }); 30 | })); 31 | } 32 | 33 | @override 34 | void dispose() { 35 | _subscriptions.dispose(); 36 | super.dispose(); 37 | } 38 | 39 | @override 40 | Widget build(BuildContext context) { 41 | return Scaffold( 42 | appBar: AppBar( 43 | title: const Text("RxDart State"), 44 | ), 45 | body: Column( 46 | children: [ 47 | Container( 48 | margin: const EdgeInsets.all(10), 49 | child: TextField( 50 | onChanged: _viewModel.searchByCountry, 51 | decoration: const InputDecoration( 52 | labelText: 'Search', suffixIcon: Icon(Icons.search)), 53 | ), 54 | ), 55 | Expanded( 56 | child: _screenState.when( 57 | data: (e) => _buildUniversities(e.universities), 58 | loading: () => _buildLoading(), 59 | appError: (e) => _buildError(e.toString()), 60 | apiError: (e) => _buildError(e.toString())), 61 | ), 62 | ], 63 | ), 64 | ); 65 | } 66 | 67 | Widget _buildUniversities(List universities) { 68 | return ListView.builder( 69 | itemCount: universities.length, 70 | itemBuilder: (BuildContext context, int index) { 71 | return Card( 72 | elevation: 5, 73 | margin: const EdgeInsets.all(10), 74 | child: Container( 75 | padding: const EdgeInsets.all(25), 76 | child: Column( 77 | children: [ 78 | Text("Name: ${universities[index].name}"), 79 | Text("Country: ${universities[index].country}"), 80 | Text("Website: ${universities[index].website}"), 81 | ], 82 | ), 83 | ), 84 | ); 85 | }, 86 | ); 87 | } 88 | 89 | Widget _buildLoading() { 90 | return const Center( 91 | child: CircularProgressIndicator(), 92 | ); 93 | } 94 | 95 | Widget _buildError(String error) { 96 | return Center( 97 | child: Text( 98 | error, 99 | style: 100 | Theme.of(context).textTheme.headline3?.copyWith(color: Colors.red), 101 | ), 102 | ); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /test/unit_test/universities_feed/data/source/network/endpoint/university_endpoint_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | import 'package:rxdart_state_management_article/features/universities_feed/data/source/network/endpoint/university_endpoint.dart'; 4 | import 'package:rxdart_state_management_article/features/universities_feed/data/source/network/model/api_university_model.dart'; 5 | 6 | import '../../../../../network_config/mock_interceptor/dio_mock_responses_adapter.dart'; 7 | 8 | void main() { 9 | late Dio dioClient; 10 | late UniversityEndpoint endpoint; 11 | late String baseUrl; 12 | 13 | DioMockResponsesAdapter _createMockAdapterForSearchRequest( 14 | int responseCode, Object responseBody) { 15 | return DioMockResponsesAdapter(MockAdapterInterceptor( 16 | RequestType.GET, 17 | baseUrl, 18 | "/search", 19 | {"country": "us"}, 20 | responseBody, 21 | responseCode, 22 | )); 23 | } 24 | 25 | List> generateTwoValidUniversities() => [ 26 | { 27 | "alpha_two_code": "US", 28 | "domains": ["marywood.edu"], 29 | "country": "United States", 30 | "state-province": null, 31 | "web_pages": ["http://www.marywood.edu"], 32 | "name": "Marywood University" 33 | }, 34 | { 35 | "alpha_two_code": "US", 36 | "domains": ["lindenwood.edu"], 37 | "country": "United States", 38 | "state-province": null, 39 | "web_pages": ["http://www.lindenwood.edu/"], 40 | "name": "Lindenwood University" 41 | }, 42 | ]; 43 | 44 | List expectedTwoValidUniversities() => [ 45 | ApiUniversityModel( 46 | alphaCode: "US", 47 | country: "United States", 48 | state: null, 49 | name: "Marywood University", 50 | websites: ["http://www.marywood.edu"], 51 | domains: ["marywood.edu"], 52 | ), 53 | ApiUniversityModel( 54 | alphaCode: "US", 55 | country: "United States", 56 | state: null, 57 | name: "Lindenwood University", 58 | websites: ["http://www.lindenwood.edu/"], 59 | domains: ["lindenwood.edu"], 60 | ), 61 | ]; 62 | 63 | group("Test University Endpoint API calls", () { 64 | setUp(() { 65 | baseUrl = "https://test.url"; 66 | dioClient = Dio(BaseOptions()); 67 | endpoint = UniversityEndpoint(dioClient, baseUrl: baseUrl); 68 | }); 69 | 70 | test('Test endpoint calls dio', () async { 71 | dioClient.httpClientAdapter = _createMockAdapterForSearchRequest( 72 | 200, 73 | [], 74 | ); 75 | var result = await endpoint.getUniversitiesByCountry("us"); 76 | expect(result, []); 77 | }); 78 | 79 | test('Test endpoint returns error', () async { 80 | dioClient.httpClientAdapter = _createMockAdapterForSearchRequest( 81 | 404, 82 | {"error": "Not found!"}, 83 | ); 84 | List? response; 85 | DioError? error; 86 | try { 87 | response = await endpoint.getUniversitiesByCountry("us"); 88 | } on DioError catch (dioError, _) { 89 | error = dioError; 90 | } 91 | expect(response, null); 92 | expect(error?.error, "Http status error [404]"); 93 | }); 94 | 95 | test('Test endpoint calls and returns 2 valid universities', () async { 96 | dioClient.httpClientAdapter = _createMockAdapterForSearchRequest( 97 | 200, 98 | generateTwoValidUniversities(), 99 | ); 100 | var result = await endpoint.getUniversitiesByCountry("us"); 101 | expect(result, expectedTwoValidUniversities()); 102 | }); 103 | }); 104 | } 105 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: rxdart_state_management_article 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 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 | version: 1.0.0+1 19 | 20 | environment: 21 | sdk: ">=2.17.0 <3.0.0" 22 | 23 | # Dependencies specify other packages that your package needs in order to work. 24 | # To automatically upgrade your package dependencies to the latest versions 25 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 26 | # dependencies can be manually updated by changing the version numbers below to 27 | # the latest version available on pub.dev. To see which dependencies have newer 28 | # versions available, run `flutter pub outdated`. 29 | dependencies: 30 | flutter: 31 | sdk: flutter 32 | rxdart: ^0.27.4 33 | riverpod: ^2.0.0-dev.7 34 | retrofit: '>=3.0.0 <4.0.0' 35 | logger: any 36 | freezed_annotation: ^2.0.3 37 | json_annotation: ^4.5.0 38 | mockito: ^5.2.0 39 | 40 | 41 | # The following adds the Cupertino Icons font to your application. 42 | # Use with the CupertinoIcons class for iOS style icons. 43 | cupertino_icons: ^1.0.5 44 | 45 | 46 | dev_dependencies: 47 | flutter_test: 48 | sdk: flutter 49 | 50 | # The "flutter_lints" package below contains a set of recommended lints to 51 | # encourage good coding practices. The lint set provided by the package is 52 | # activated in the `analysis_options.yaml` file located at the root of your 53 | # package. See that file for information about deactivating specific lint 54 | # rules and activating additional ones. 55 | flutter_lints: ^2.0.0 56 | build_runner: ^2.1.11 57 | freezed: ^2.0.3+1 58 | retrofit_generator: '>=4.0.0 <5.0.0' 59 | json_serializable: '>4.4.0' 60 | 61 | # For information on the generic Dart part of this file, see the 62 | # following page: https://dart.dev/tools/pub/pubspec 63 | 64 | # The following section is specific to Flutter packages. 65 | flutter: 66 | 67 | # The following line ensures that the Material Icons font is 68 | # included with your application, so that you can use the icons in 69 | # the material Icons class. 70 | uses-material-design: true 71 | 72 | # To add assets to your application, add an assets section, like this: 73 | # assets: 74 | # - images/a_dot_burr.jpeg 75 | # - images/a_dot_ham.jpeg 76 | 77 | # An image asset can refer to one or more resolution-specific "variants", see 78 | # https://flutter.dev/assets-and-images/#resolution-aware 79 | 80 | # For details regarding adding assets from package dependencies, see 81 | # https://flutter.dev/assets-and-images/#from-packages 82 | 83 | # To add custom fonts to your application, add a fonts section here, 84 | # in this "flutter" section. Each entry in this list should have a 85 | # "family" key with the font family name, and a "fonts" key with a 86 | # list giving the asset and other descriptors for the font. For 87 | # example: 88 | # fonts: 89 | # - family: Schyler 90 | # fonts: 91 | # - asset: fonts/Schyler-Regular.ttf 92 | # - asset: fonts/Schyler-Italic.ttf 93 | # style: italic 94 | # - family: Trajan Pro 95 | # fonts: 96 | # - asset: fonts/TrajanPro.ttf 97 | # - asset: fonts/TrajanPro_Bold.ttf 98 | # weight: 700 99 | # 100 | # For details regarding fonts from package dependencies, 101 | # see https://flutter.dev/custom-fonts/#from-packages 102 | -------------------------------------------------------------------------------- /test/unit_test/universities_feed/domain/usecase/get_universities_by_country_use_case_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:mockito/annotations.dart'; 3 | import 'package:mockito/mockito.dart'; 4 | import 'package:rxdart_state_management_article/features/universities_feed/domain/entity/university.dart'; 5 | import 'package:rxdart_state_management_article/features/universities_feed/domain/repository/untiversities_repository.dart'; 6 | import 'package:rxdart_state_management_article/features/universities_feed/domain/usecase/get_universities_by_country_use_case.dart'; 7 | import 'package:rxdart_state_management_article/features/universities_feed/presentation/models/university_screen_model.dart'; 8 | import 'package:rxdart_state_management_article/features/universities_feed/presentation/models/university_screen_state.dart'; 9 | import 'package:rxdart_state_management_article/network_config/app_result.dart'; 10 | 11 | import 'get_universities_by_country_use_case_test.mocks.dart'; 12 | 13 | @GenerateMocks([UniversitiesRepository]) 14 | void main() { 15 | late UniversitiesRepository repository; 16 | late GetUniversitiesByCountryUseCase useCase; 17 | 18 | List universities = [ 19 | University( 20 | alphaCode: "US", 21 | country: "United States", 22 | state: "", 23 | name: "Marywood University", 24 | websites: ["http://www.marywood.edu"], 25 | domains: ["marywood.edu"], 26 | ), 27 | University( 28 | alphaCode: "US", 29 | country: "United States", 30 | state: "", 31 | name: "Lindenwood University", 32 | websites: ["http://www.lindenwood.edu/"], 33 | domains: ["lindenwood.edu"], 34 | ), 35 | ]; 36 | UniversityScreenState expectedScreenState = 37 | UniversityScreenState(universities: [ 38 | UniversityScreenModel( 39 | country: "United States", 40 | name: "Marywood University", 41 | website: "http://www.marywood.edu"), 42 | UniversityScreenModel( 43 | country: "United States", 44 | name: "Lindenwood University", 45 | website: "http://www.lindenwood.edu/") 46 | ]); 47 | 48 | group("Test function calls", () { 49 | setUp(() { 50 | repository = MockUniversitiesRepository(); 51 | useCase = 52 | GetUniversitiesByCountryUseCase(universitiesRepository: repository); 53 | }); 54 | 55 | test('Test useCase calls getUniversities from repository', () { 56 | when(repository.getUniversities("test")).thenAnswer((realInvocation) => 57 | Stream.value(const AppResult.data([]))); 58 | 59 | useCase.invoke("test"); 60 | verify(repository.getUniversities("test")); 61 | }); 62 | 63 | test( 64 | 'Test useCase maps getUniversities response to UniversityScreenState with empty list', 65 | () { 66 | when(repository.getUniversities("test")).thenAnswer((realInvocation) => 67 | Stream.value(const AppResult.data([]))); 68 | 69 | expect( 70 | useCase.invoke("test"), 71 | emitsInOrder([ 72 | AppResult.data( 73 | UniversityScreenState(universities: [])) 74 | ]), 75 | ); 76 | }); 77 | 78 | test( 79 | 'Test useCase maps getUniversities response to UniversityScreenState with items in list', 80 | () { 81 | when(repository.getUniversities("test")).thenAnswer( 82 | (realInvocation) => Stream.value(AppResult.data(universities))); 83 | 84 | expect( 85 | useCase.invoke("test"), 86 | emitsInOrder( 87 | [AppResult.data(expectedScreenState)]), 88 | ); 89 | }); 90 | 91 | test( 92 | 'Test useCase gets all app result state events on stream and maps them successfully', 93 | () { 94 | when(repository.getUniversities("test")) 95 | .thenAnswer((realInvocation) => Stream.fromIterable([ 96 | const AppResult.loading(), 97 | const AppResult>.appError("Error"), 98 | const AppResult>.data([]), 99 | ])); 100 | 101 | expect( 102 | useCase.invoke("test"), 103 | emitsInOrder([ 104 | const AppResult.loading(), 105 | const AppResult.appError("Error"), 106 | AppResult.data( 107 | UniversityScreenState(universities: [])) 108 | ]), 109 | ); 110 | }); 111 | }); 112 | } 113 | -------------------------------------------------------------------------------- /test/unit_test/extensions/map_extensions_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:rxdart_state_management_article/utils/extensions/map_extensions.dart'; 3 | 4 | void main() { 5 | group("Test hasSameElementsAs extension", () { 6 | Map mapOfIntAndInt = 7 | Map.fromEntries(List.generate(10, (index) => MapEntry(index, index))); 8 | 9 | Map mapOfStringAndInt = Map.fromEntries( 10 | List.generate(10, (index) => MapEntry(index.toString(), index))); 11 | 12 | Map> mapOfStringAndListOfStrings = Map.fromEntries( 13 | List.generate( 14 | 10, 15 | (index1) => MapEntry( 16 | index1.toString(), List.generate(5, (index2) => "$index1-$index2")), 17 | ), 18 | ); 19 | 20 | Map> mapOfStringAndMapOfStringAndInt = 21 | Map.fromEntries(List.generate( 22 | 10, 23 | (index1) => MapEntry( 24 | index1.toString(), 25 | Map.fromEntries( 26 | List.generate(5, (index2) => MapEntry("$index1-$index2", index2))), 27 | ), 28 | )); 29 | 30 | Map>> mapOfStringAndMapOfStringAndListOfInt = 31 | Map.fromEntries(List.generate( 32 | 10, 33 | (index1) => MapEntry( 34 | index1.toString(), 35 | Map.fromEntries(List.generate( 36 | 5, 37 | (index2) => MapEntry( 38 | "$index1-$index2", 39 | List.generate(3, (index) => index), 40 | ))), 41 | ), 42 | )); 43 | 44 | Map, Map>> 45 | mapOfListOfStringsAndMapOfStringAndListOfInt = 46 | Map.fromEntries(List.generate( 47 | 10, 48 | (index1) => MapEntry( 49 | List.generate(5, (index) => index.toString()), 50 | Map.fromEntries(List.generate( 51 | 5, 52 | (index2) => MapEntry( 53 | "$index1-$index2", 54 | List.generate(3, (index) => index), 55 | ))), 56 | ), 57 | )); 58 | 59 | Map, Map>> 60 | mapOfMapOfStringAndIntAndMapOfStringAndListOfInt = 61 | Map.fromEntries(List.generate( 62 | 10, 63 | (index1) => MapEntry( 64 | Map.fromEntries(List.generate( 65 | 5, 66 | (index2) => MapEntry( 67 | "$index1-$index2", 68 | index2, 69 | ))), 70 | Map.fromEntries(List.generate( 71 | 5, 72 | (index2) => MapEntry( 73 | "$index1-$index2", 74 | List.generate(3, (index) => index), 75 | ))), 76 | ), 77 | )); 78 | 79 | test('Test hasSameElementsAs on null', () { 80 | expect( 81 | mapOfIntAndInt.hasSameElementsAs(null), 82 | false, 83 | ); 84 | }); 85 | 86 | test('Test hasSameElementsAs on null', () { 87 | expect( 88 | mapOfIntAndInt.hasSameElementsAs({}), 89 | false, 90 | ); 91 | }); 92 | 93 | test('Test hasSameElementsAs on Map', () { 94 | expect( 95 | mapOfIntAndInt.hasSameElementsAs(mapOfIntAndInt), 96 | true, 97 | ); 98 | }); 99 | 100 | test('Test hasSameElementsAs on Map', () { 101 | expect( 102 | mapOfStringAndInt.hasSameElementsAs(mapOfStringAndInt), 103 | true, 104 | ); 105 | }); 106 | 107 | test('Test hasSameElementsAs on Map>', () { 108 | expect( 109 | mapOfStringAndListOfStrings 110 | .hasSameElementsAs(mapOfStringAndListOfStrings), 111 | true, 112 | ); 113 | }); 114 | 115 | test('Test hasSameElementsAs on Map>', () { 116 | expect( 117 | mapOfStringAndMapOfStringAndInt 118 | .hasSameElementsAs(mapOfStringAndMapOfStringAndInt), 119 | true, 120 | ); 121 | }); 122 | 123 | test('Test hasSameElementsAs on Map>>', () { 124 | expect( 125 | mapOfStringAndMapOfStringAndListOfInt 126 | .hasSameElementsAs(mapOfStringAndMapOfStringAndListOfInt), 127 | true, 128 | ); 129 | }); 130 | 131 | test('Test hasSameElementsAs on Map, Map>>', 132 | () { 133 | expect( 134 | mapOfListOfStringsAndMapOfStringAndListOfInt 135 | .hasSameElementsAs(mapOfListOfStringsAndMapOfStringAndListOfInt), 136 | true, 137 | ); 138 | }); 139 | 140 | test( 141 | 'Test hasSameElementsAs on Map, Map>>', 142 | () { 143 | expect( 144 | mapOfMapOfStringAndIntAndMapOfStringAndListOfInt.hasSameElementsAs( 145 | mapOfMapOfStringAndIntAndMapOfStringAndListOfInt), 146 | true, 147 | ); 148 | }); 149 | }); 150 | } 151 | -------------------------------------------------------------------------------- /.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 | *.g.dart 35 | *.chopper.dart 36 | *.freezed.dart 37 | *.mocks.dart 38 | 39 | # Web related 40 | lib/generated_plugin_registrant.dart 41 | 42 | # Symbolication related 43 | app.*.symbols 44 | 45 | # Obfuscation related 46 | app.*.map.json 47 | 48 | # Android Studio will place build artifacts here 49 | /android/app/debug 50 | /android/app/profile 51 | /android/app/release 52 | **/android/**/gradle-wrapper.jar 53 | **/android/.gradle 54 | **/android/captures/ 55 | **/android/gradlew 56 | **/android/gradlew.bat 57 | **/android/key.properties 58 | **/android/local.properties 59 | **/android/**/GeneratedPluginRegistrant.java 60 | 61 | # iOS/XCode related 62 | **/ios/**/*.mode1v3 63 | **/ios/**/*.mode2v3 64 | **/ios/**/*.moved-aside 65 | **/ios/**/*.pbxuser 66 | **/ios/**/*.perspectivev3 67 | **/ios/**/*sync/ 68 | **/ios/**/.sconsign.dblite 69 | **/ios/**/.tags* 70 | **/ios/**/.vagrant/ 71 | **/ios/**/DerivedData/ 72 | **/ios/**/Icon? 73 | **/ios/**/Pods/ 74 | **/ios/**/.symlinks/ 75 | **/ios/**/profile 76 | **/ios/**/xcuserdata 77 | **/ios/.generated/ 78 | **/ios/Flutter/.last_build_id 79 | **/ios/Flutter/App.framework 80 | **/ios/Flutter/Flutter.framework 81 | **/ios/Flutter/Flutter.podspec 82 | **/ios/Flutter/Generated.xcconfig 83 | **/ios/Flutter/app.flx 84 | **/ios/Flutter/app.zip 85 | **/ios/Flutter/flutter_assets/ 86 | **/ios/Flutter/flutter_export_environment.sh 87 | **/ios/ServiceDefinitions.json 88 | **/ios/Runner/GeneratedPluginRegistrant.* 89 | 90 | # Exceptions to above rules. 91 | !**/ios/**/default.mode1v3 92 | !**/ios/**/default.mode2v3 93 | !**/ios/**/default.pbxuser 94 | !**/ios/**/default.perspectivev3 95 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 96 | 97 | ### AndroidStudio ### 98 | # Covers files to be ignored for android development using Android Studio. 99 | 100 | # Built application files 101 | *.apk 102 | *.ap_ 103 | *.aab 104 | 105 | # Files for the ART/Dalvik VM 106 | *.dex 107 | 108 | # Java class files 109 | *.class 110 | 111 | # Generated files 112 | bin/ 113 | gen/ 114 | out/ 115 | 116 | # Gradle files 117 | .gradle 118 | .gradle/ 119 | 120 | # Signing files 121 | .signing/ 122 | 123 | # Local configuration file (sdk path, etc) 124 | local.properties 125 | 126 | # Proguard folder generated by Eclipse 127 | proguard/ 128 | 129 | # Log Files 130 | *.log 131 | 132 | # Android Studio 133 | /*/build/ 134 | /*/local.properties 135 | /*/out 136 | /*/*/build 137 | /*/*/production 138 | captures/ 139 | .navigation/ 140 | *.ipr 141 | *~ 142 | *.swp 143 | 144 | # Keystore files 145 | *.jks 146 | *.keystore 147 | 148 | # Google Services (e.g. APIs or Firebase) 149 | # google-services.json 150 | 151 | # Android Patch 152 | gen-external-apklibs 153 | 154 | # External native build folder generated in Android Studio 2.2 and later 155 | .externalNativeBuild 156 | 157 | # NDK 158 | obj/ 159 | 160 | # IntelliJ IDEA 161 | *.iml 162 | *.iws 163 | /out/ 164 | 165 | # User-specific configurations 166 | .idea/caches/ 167 | .idea/libraries/ 168 | .idea/shelf/ 169 | .idea/workspace.xml 170 | .idea/tasks.xml 171 | .idea/.name 172 | .idea/compiler.xml 173 | .idea/copyright/profiles_settings.xml 174 | .idea/encodings.xml 175 | .idea/misc.xml 176 | .idea/modules.xml 177 | .idea/scopes/scope_settings.xml 178 | .idea/dictionaries 179 | .idea/vcs.xml 180 | .idea/jsLibraryMappings.xml 181 | .idea/datasources.xml 182 | .idea/dataSources.ids 183 | .idea/sqlDataSources.xml 184 | .idea/dynamic.xml 185 | .idea/uiDesigner.xml 186 | .idea/assetWizardSettings.xml 187 | .idea/gradle.xml 188 | .idea/jarRepositories.xml 189 | .idea/navEditor.xml 190 | 191 | # Legacy Eclipse project files 192 | .classpath 193 | .project 194 | .cproject 195 | .settings/ 196 | 197 | # Mobile Tools for Java (J2ME) 198 | .mtj.tmp/ 199 | 200 | # Package Files # 201 | *.war 202 | *.ear 203 | 204 | # virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml) 205 | hs_err_pid* 206 | 207 | ## Plugin-specific files: 208 | 209 | # mpeltonen/sbt-idea plugin 210 | .idea_modules/ 211 | 212 | # JIRA plugin 213 | atlassian-ide-plugin.xml 214 | 215 | # Mongo Explorer plugin 216 | .idea/mongoSettings.xml 217 | 218 | # Crashlytics plugin (for Android Studio and IntelliJ) 219 | com_crashlytics_export_strings.xml 220 | crashlytics.properties 221 | crashlytics-build.properties 222 | fabric.properties 223 | 224 | ### AndroidStudio Patch ### 225 | 226 | !/gradle/wrapper/gradle-wrapper.jar 227 | 228 | # End of https://www.toptal.com/developers/gitignore/api/flutter,androidstudio -------------------------------------------------------------------------------- /test/unit_test/universities_feed/presentation/screen/universities_view_model_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:mockito/annotations.dart'; 3 | import 'package:mockito/mockito.dart'; 4 | import 'package:rxdart_state_management_article/features/universities_feed/domain/usecase/get_universities_by_country_use_case.dart'; 5 | import 'package:rxdart_state_management_article/features/universities_feed/presentation/models/university_screen_model.dart'; 6 | import 'package:rxdart_state_management_article/features/universities_feed/presentation/models/university_screen_state.dart'; 7 | import 'package:rxdart_state_management_article/features/universities_feed/presentation/screen/universities_view_model.dart'; 8 | import 'package:rxdart_state_management_article/network_config/api_error.dart'; 9 | import 'package:rxdart_state_management_article/network_config/app_result.dart'; 10 | 11 | import 'universities_view_model_test.mocks.dart'; 12 | 13 | @GenerateMocks([GetUniversitiesByCountryUseCase]) 14 | void main() { 15 | late GetUniversitiesByCountryUseCase useCase; 16 | late UniversitiesViewModel viewModel; 17 | 18 | UniversityScreenState universityScreenState = 19 | UniversityScreenState(universities: [ 20 | UniversityScreenModel( 21 | country: "United States", 22 | name: "Marywood University", 23 | website: "http://www.marywood.edu"), 24 | UniversityScreenModel( 25 | country: "United States", 26 | name: "Lindenwood University", 27 | website: "http://www.lindenwood.edu/") 28 | ]); 29 | 30 | group("Test function calls", () { 31 | setUp(() { 32 | useCase = MockGetUniversitiesByCountryUseCase(); 33 | viewModel = 34 | UniversitiesViewModel(getUniversitiesByCountryUseCase: useCase); 35 | }); 36 | 37 | test( 38 | 'Test viewModel calls GetUniversitiesByCountryUseCase when stream universities is subscribed', 39 | () async { 40 | when(useCase.invoke(null)) 41 | .thenAnswer((realInvocation) => Stream.fromIterable([ 42 | AppResult.data(UniversityScreenState(universities: [])), 43 | ])); 44 | 45 | await viewModel.universities.take(1).toList(); 46 | verify(useCase.invoke(null)); 47 | }); 48 | 49 | test( 50 | 'Test viewModel calls GetUniversitiesByCountryUseCase when stream universities is subscribed and gets loading and data', 51 | () { 52 | when(useCase.invoke(null)) 53 | .thenAnswer((realInvocation) => Stream.fromIterable([ 54 | const AppResult.loading(), 55 | AppResult.data(universityScreenState), 56 | ])); 57 | 58 | expect( 59 | viewModel.universities, 60 | emitsInOrder([ 61 | const AppResult.loading(), 62 | AppResult.data(UniversityScreenState( 63 | universities: universityScreenState.universities)) 64 | ]), 65 | ); 66 | }); 67 | 68 | test( 69 | 'Test viewModel calls GetUniversitiesByCountryUseCase when stream universities is subscribed and gets loading and appError', 70 | () { 71 | when(useCase.invoke(null)) 72 | .thenAnswer((realInvocation) => Stream.fromIterable([ 73 | const AppResult.loading(), 74 | const AppResult.appError("Error"), 75 | ])); 76 | 77 | expect( 78 | viewModel.universities, 79 | emitsInOrder([ 80 | const AppResult.loading(), 81 | const AppResult.appError("Error"), 82 | ]), 83 | ); 84 | }); 85 | 86 | test( 87 | 'Test viewModel calls GetUniversitiesByCountryUseCase when stream universities is subscribed and gets loading and apiError', 88 | () { 89 | ApiError apiError = ApiError(statusCode: 500, message: "Server Error"); 90 | when(useCase.invoke(null)) 91 | .thenAnswer((realInvocation) => Stream.fromIterable([ 92 | const AppResult.loading(), 93 | AppResult.apiError(apiError), 94 | ])); 95 | 96 | expect( 97 | viewModel.universities, 98 | emitsInOrder([ 99 | const AppResult.loading(), 100 | AppResult.apiError(apiError), 101 | ]), 102 | ); 103 | }); 104 | 105 | test('Test viewModel search by country', () async { 106 | // We need to mock the call with null parameter because this is always 107 | // called by the universities stream when it gets a new subscriber 108 | when(useCase.invoke(null)).thenAnswer((_) => Stream.fromIterable([ 109 | const AppResult.loading(), 110 | AppResult.data(UniversityScreenState(universities: [])), 111 | ])); 112 | when(useCase.invoke("test country")).thenAnswer( 113 | (_) => Stream.value(AppResult.data(universityScreenState))); 114 | expect( 115 | viewModel.universities, 116 | emitsInOrder([ 117 | const AppResult.loading(), 118 | AppResult.data( 119 | UniversityScreenState(universities: [])), 120 | AppResult.data(UniversityScreenState( 121 | universities: universityScreenState.universities)) 122 | ]), 123 | ); 124 | // Since "expect" does async calls to verify our streams we need to wait 125 | // for some milliseconds before we trigger a search, otherwise the searchByCountry 126 | // method is called and an event will be sent to the universities stream 127 | // right after it was bind and then the order of the responses won't match anymore 128 | await Future.delayed(const Duration(milliseconds: 500)); 129 | viewModel.searchByCountry("test country"); 130 | }); 131 | }); 132 | } 133 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | _fe_analyzer_shared: 5 | dependency: transitive 6 | description: 7 | name: _fe_analyzer_shared 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "38.0.0" 11 | analyzer: 12 | dependency: transitive 13 | description: 14 | name: analyzer 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "3.4.1" 18 | args: 19 | dependency: transitive 20 | description: 21 | name: args 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "2.3.1" 25 | async: 26 | dependency: transitive 27 | description: 28 | name: async 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "2.8.2" 32 | boolean_selector: 33 | dependency: transitive 34 | description: 35 | name: boolean_selector 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "2.1.0" 39 | build: 40 | dependency: transitive 41 | description: 42 | name: build 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "2.3.0" 46 | build_config: 47 | dependency: transitive 48 | description: 49 | name: build_config 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "1.0.0" 53 | build_daemon: 54 | dependency: transitive 55 | description: 56 | name: build_daemon 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "3.1.0" 60 | build_resolvers: 61 | dependency: transitive 62 | description: 63 | name: build_resolvers 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "2.0.9" 67 | build_runner: 68 | dependency: "direct dev" 69 | description: 70 | name: build_runner 71 | url: "https://pub.dartlang.org" 72 | source: hosted 73 | version: "2.1.11" 74 | build_runner_core: 75 | dependency: transitive 76 | description: 77 | name: build_runner_core 78 | url: "https://pub.dartlang.org" 79 | source: hosted 80 | version: "7.2.3" 81 | built_collection: 82 | dependency: transitive 83 | description: 84 | name: built_collection 85 | url: "https://pub.dartlang.org" 86 | source: hosted 87 | version: "5.1.1" 88 | built_value: 89 | dependency: transitive 90 | description: 91 | name: built_value 92 | url: "https://pub.dartlang.org" 93 | source: hosted 94 | version: "8.3.3" 95 | characters: 96 | dependency: transitive 97 | description: 98 | name: characters 99 | url: "https://pub.dartlang.org" 100 | source: hosted 101 | version: "1.2.0" 102 | charcode: 103 | dependency: transitive 104 | description: 105 | name: charcode 106 | url: "https://pub.dartlang.org" 107 | source: hosted 108 | version: "1.3.1" 109 | checked_yaml: 110 | dependency: transitive 111 | description: 112 | name: checked_yaml 113 | url: "https://pub.dartlang.org" 114 | source: hosted 115 | version: "2.0.1" 116 | clock: 117 | dependency: transitive 118 | description: 119 | name: clock 120 | url: "https://pub.dartlang.org" 121 | source: hosted 122 | version: "1.1.0" 123 | code_builder: 124 | dependency: transitive 125 | description: 126 | name: code_builder 127 | url: "https://pub.dartlang.org" 128 | source: hosted 129 | version: "4.1.0" 130 | collection: 131 | dependency: transitive 132 | description: 133 | name: collection 134 | url: "https://pub.dartlang.org" 135 | source: hosted 136 | version: "1.16.0" 137 | convert: 138 | dependency: transitive 139 | description: 140 | name: convert 141 | url: "https://pub.dartlang.org" 142 | source: hosted 143 | version: "3.0.2" 144 | crypto: 145 | dependency: transitive 146 | description: 147 | name: crypto 148 | url: "https://pub.dartlang.org" 149 | source: hosted 150 | version: "3.0.2" 151 | cupertino_icons: 152 | dependency: "direct main" 153 | description: 154 | name: cupertino_icons 155 | url: "https://pub.dartlang.org" 156 | source: hosted 157 | version: "1.0.5" 158 | dart_style: 159 | dependency: transitive 160 | description: 161 | name: dart_style 162 | url: "https://pub.dartlang.org" 163 | source: hosted 164 | version: "2.2.3" 165 | dio: 166 | dependency: transitive 167 | description: 168 | name: dio 169 | url: "https://pub.dartlang.org" 170 | source: hosted 171 | version: "4.0.6" 172 | fake_async: 173 | dependency: transitive 174 | description: 175 | name: fake_async 176 | url: "https://pub.dartlang.org" 177 | source: hosted 178 | version: "1.3.0" 179 | file: 180 | dependency: transitive 181 | description: 182 | name: file 183 | url: "https://pub.dartlang.org" 184 | source: hosted 185 | version: "6.1.2" 186 | fixnum: 187 | dependency: transitive 188 | description: 189 | name: fixnum 190 | url: "https://pub.dartlang.org" 191 | source: hosted 192 | version: "1.0.1" 193 | flutter: 194 | dependency: "direct main" 195 | description: flutter 196 | source: sdk 197 | version: "0.0.0" 198 | flutter_lints: 199 | dependency: "direct dev" 200 | description: 201 | name: flutter_lints 202 | url: "https://pub.dartlang.org" 203 | source: hosted 204 | version: "2.0.1" 205 | flutter_test: 206 | dependency: "direct dev" 207 | description: flutter 208 | source: sdk 209 | version: "0.0.0" 210 | freezed: 211 | dependency: "direct dev" 212 | description: 213 | name: freezed 214 | url: "https://pub.dartlang.org" 215 | source: hosted 216 | version: "2.0.3+1" 217 | freezed_annotation: 218 | dependency: "direct main" 219 | description: 220 | name: freezed_annotation 221 | url: "https://pub.dartlang.org" 222 | source: hosted 223 | version: "2.0.3" 224 | frontend_server_client: 225 | dependency: transitive 226 | description: 227 | name: frontend_server_client 228 | url: "https://pub.dartlang.org" 229 | source: hosted 230 | version: "2.1.3" 231 | glob: 232 | dependency: transitive 233 | description: 234 | name: glob 235 | url: "https://pub.dartlang.org" 236 | source: hosted 237 | version: "2.1.0" 238 | graphs: 239 | dependency: transitive 240 | description: 241 | name: graphs 242 | url: "https://pub.dartlang.org" 243 | source: hosted 244 | version: "2.1.0" 245 | http_multi_server: 246 | dependency: transitive 247 | description: 248 | name: http_multi_server 249 | url: "https://pub.dartlang.org" 250 | source: hosted 251 | version: "3.2.1" 252 | http_parser: 253 | dependency: transitive 254 | description: 255 | name: http_parser 256 | url: "https://pub.dartlang.org" 257 | source: hosted 258 | version: "4.0.1" 259 | io: 260 | dependency: transitive 261 | description: 262 | name: io 263 | url: "https://pub.dartlang.org" 264 | source: hosted 265 | version: "1.0.3" 266 | js: 267 | dependency: transitive 268 | description: 269 | name: js 270 | url: "https://pub.dartlang.org" 271 | source: hosted 272 | version: "0.6.4" 273 | json_annotation: 274 | dependency: "direct main" 275 | description: 276 | name: json_annotation 277 | url: "https://pub.dartlang.org" 278 | source: hosted 279 | version: "4.5.0" 280 | json_serializable: 281 | dependency: "direct dev" 282 | description: 283 | name: json_serializable 284 | url: "https://pub.dartlang.org" 285 | source: hosted 286 | version: "6.2.0" 287 | lints: 288 | dependency: transitive 289 | description: 290 | name: lints 291 | url: "https://pub.dartlang.org" 292 | source: hosted 293 | version: "2.0.0" 294 | logger: 295 | dependency: "direct main" 296 | description: 297 | name: logger 298 | url: "https://pub.dartlang.org" 299 | source: hosted 300 | version: "1.1.0" 301 | logging: 302 | dependency: transitive 303 | description: 304 | name: logging 305 | url: "https://pub.dartlang.org" 306 | source: hosted 307 | version: "1.0.2" 308 | matcher: 309 | dependency: transitive 310 | description: 311 | name: matcher 312 | url: "https://pub.dartlang.org" 313 | source: hosted 314 | version: "0.12.11" 315 | material_color_utilities: 316 | dependency: transitive 317 | description: 318 | name: material_color_utilities 319 | url: "https://pub.dartlang.org" 320 | source: hosted 321 | version: "0.1.4" 322 | meta: 323 | dependency: transitive 324 | description: 325 | name: meta 326 | url: "https://pub.dartlang.org" 327 | source: hosted 328 | version: "1.7.0" 329 | mime: 330 | dependency: transitive 331 | description: 332 | name: mime 333 | url: "https://pub.dartlang.org" 334 | source: hosted 335 | version: "1.0.2" 336 | mockito: 337 | dependency: "direct main" 338 | description: 339 | name: mockito 340 | url: "https://pub.dartlang.org" 341 | source: hosted 342 | version: "5.2.0" 343 | package_config: 344 | dependency: transitive 345 | description: 346 | name: package_config 347 | url: "https://pub.dartlang.org" 348 | source: hosted 349 | version: "2.1.0" 350 | path: 351 | dependency: transitive 352 | description: 353 | name: path 354 | url: "https://pub.dartlang.org" 355 | source: hosted 356 | version: "1.8.1" 357 | pool: 358 | dependency: transitive 359 | description: 360 | name: pool 361 | url: "https://pub.dartlang.org" 362 | source: hosted 363 | version: "1.5.1" 364 | pub_semver: 365 | dependency: transitive 366 | description: 367 | name: pub_semver 368 | url: "https://pub.dartlang.org" 369 | source: hosted 370 | version: "2.1.1" 371 | pubspec_parse: 372 | dependency: transitive 373 | description: 374 | name: pubspec_parse 375 | url: "https://pub.dartlang.org" 376 | source: hosted 377 | version: "1.2.0" 378 | quiver: 379 | dependency: transitive 380 | description: 381 | name: quiver 382 | url: "https://pub.dartlang.org" 383 | source: hosted 384 | version: "3.1.0" 385 | retrofit: 386 | dependency: "direct main" 387 | description: 388 | name: retrofit 389 | url: "https://pub.dartlang.org" 390 | source: hosted 391 | version: "3.0.1+1" 392 | retrofit_generator: 393 | dependency: "direct dev" 394 | description: 395 | name: retrofit_generator 396 | url: "https://pub.dartlang.org" 397 | source: hosted 398 | version: "4.0.1" 399 | riverpod: 400 | dependency: "direct main" 401 | description: 402 | name: riverpod 403 | url: "https://pub.dartlang.org" 404 | source: hosted 405 | version: "2.0.0-dev.9" 406 | rxdart: 407 | dependency: "direct main" 408 | description: 409 | name: rxdart 410 | url: "https://pub.dartlang.org" 411 | source: hosted 412 | version: "0.27.4" 413 | shelf: 414 | dependency: transitive 415 | description: 416 | name: shelf 417 | url: "https://pub.dartlang.org" 418 | source: hosted 419 | version: "1.3.1" 420 | shelf_web_socket: 421 | dependency: transitive 422 | description: 423 | name: shelf_web_socket 424 | url: "https://pub.dartlang.org" 425 | source: hosted 426 | version: "1.0.2" 427 | sky_engine: 428 | dependency: transitive 429 | description: flutter 430 | source: sdk 431 | version: "0.0.99" 432 | source_gen: 433 | dependency: transitive 434 | description: 435 | name: source_gen 436 | url: "https://pub.dartlang.org" 437 | source: hosted 438 | version: "1.2.2" 439 | source_helper: 440 | dependency: transitive 441 | description: 442 | name: source_helper 443 | url: "https://pub.dartlang.org" 444 | source: hosted 445 | version: "1.3.2" 446 | source_span: 447 | dependency: transitive 448 | description: 449 | name: source_span 450 | url: "https://pub.dartlang.org" 451 | source: hosted 452 | version: "1.8.2" 453 | stack_trace: 454 | dependency: transitive 455 | description: 456 | name: stack_trace 457 | url: "https://pub.dartlang.org" 458 | source: hosted 459 | version: "1.10.0" 460 | state_notifier: 461 | dependency: transitive 462 | description: 463 | name: state_notifier 464 | url: "https://pub.dartlang.org" 465 | source: hosted 466 | version: "0.7.2+1" 467 | stream_channel: 468 | dependency: transitive 469 | description: 470 | name: stream_channel 471 | url: "https://pub.dartlang.org" 472 | source: hosted 473 | version: "2.1.0" 474 | stream_transform: 475 | dependency: transitive 476 | description: 477 | name: stream_transform 478 | url: "https://pub.dartlang.org" 479 | source: hosted 480 | version: "2.0.0" 481 | string_scanner: 482 | dependency: transitive 483 | description: 484 | name: string_scanner 485 | url: "https://pub.dartlang.org" 486 | source: hosted 487 | version: "1.1.0" 488 | term_glyph: 489 | dependency: transitive 490 | description: 491 | name: term_glyph 492 | url: "https://pub.dartlang.org" 493 | source: hosted 494 | version: "1.2.0" 495 | test_api: 496 | dependency: transitive 497 | description: 498 | name: test_api 499 | url: "https://pub.dartlang.org" 500 | source: hosted 501 | version: "0.4.9" 502 | timing: 503 | dependency: transitive 504 | description: 505 | name: timing 506 | url: "https://pub.dartlang.org" 507 | source: hosted 508 | version: "1.0.0" 509 | tuple: 510 | dependency: transitive 511 | description: 512 | name: tuple 513 | url: "https://pub.dartlang.org" 514 | source: hosted 515 | version: "2.0.0" 516 | typed_data: 517 | dependency: transitive 518 | description: 519 | name: typed_data 520 | url: "https://pub.dartlang.org" 521 | source: hosted 522 | version: "1.3.1" 523 | vector_math: 524 | dependency: transitive 525 | description: 526 | name: vector_math 527 | url: "https://pub.dartlang.org" 528 | source: hosted 529 | version: "2.1.2" 530 | watcher: 531 | dependency: transitive 532 | description: 533 | name: watcher 534 | url: "https://pub.dartlang.org" 535 | source: hosted 536 | version: "1.0.1" 537 | web_socket_channel: 538 | dependency: transitive 539 | description: 540 | name: web_socket_channel 541 | url: "https://pub.dartlang.org" 542 | source: hosted 543 | version: "2.2.0" 544 | yaml: 545 | dependency: transitive 546 | description: 547 | name: yaml 548 | url: "https://pub.dartlang.org" 549 | source: hosted 550 | version: "3.1.1" 551 | sdks: 552 | dart: ">=2.17.0 <3.0.0" 553 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 13 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 14 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 15 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXCopyFilesBuildPhase section */ 19 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 20 | isa = PBXCopyFilesBuildPhase; 21 | buildActionMask = 2147483647; 22 | dstPath = ""; 23 | dstSubfolderSpec = 10; 24 | files = ( 25 | ); 26 | name = "Embed Frameworks"; 27 | runOnlyForDeploymentPostprocessing = 0; 28 | }; 29 | /* End PBXCopyFilesBuildPhase section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 33 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 34 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 35 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 36 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 37 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 38 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 39 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 40 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 42 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 43 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 44 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | 9740EEB11CF90186004384FC /* Flutter */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 62 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 63 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 64 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 65 | ); 66 | name = Flutter; 67 | sourceTree = ""; 68 | }; 69 | 97C146E51CF9000F007C117D = { 70 | isa = PBXGroup; 71 | children = ( 72 | 9740EEB11CF90186004384FC /* Flutter */, 73 | 97C146F01CF9000F007C117D /* Runner */, 74 | 97C146EF1CF9000F007C117D /* Products */, 75 | ); 76 | sourceTree = ""; 77 | }; 78 | 97C146EF1CF9000F007C117D /* Products */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 97C146EE1CF9000F007C117D /* Runner.app */, 82 | ); 83 | name = Products; 84 | sourceTree = ""; 85 | }; 86 | 97C146F01CF9000F007C117D /* Runner */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 90 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 91 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 92 | 97C147021CF9000F007C117D /* Info.plist */, 93 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 94 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 95 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 96 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 97 | ); 98 | path = Runner; 99 | sourceTree = ""; 100 | }; 101 | /* End PBXGroup section */ 102 | 103 | /* Begin PBXNativeTarget section */ 104 | 97C146ED1CF9000F007C117D /* Runner */ = { 105 | isa = PBXNativeTarget; 106 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 107 | buildPhases = ( 108 | 9740EEB61CF901F6004384FC /* Run Script */, 109 | 97C146EA1CF9000F007C117D /* Sources */, 110 | 97C146EB1CF9000F007C117D /* Frameworks */, 111 | 97C146EC1CF9000F007C117D /* Resources */, 112 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 113 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 114 | ); 115 | buildRules = ( 116 | ); 117 | dependencies = ( 118 | ); 119 | name = Runner; 120 | productName = Runner; 121 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 122 | productType = "com.apple.product-type.application"; 123 | }; 124 | /* End PBXNativeTarget section */ 125 | 126 | /* Begin PBXProject section */ 127 | 97C146E61CF9000F007C117D /* Project object */ = { 128 | isa = PBXProject; 129 | attributes = { 130 | LastUpgradeCheck = 1300; 131 | ORGANIZATIONNAME = ""; 132 | TargetAttributes = { 133 | 97C146ED1CF9000F007C117D = { 134 | CreatedOnToolsVersion = 7.3.1; 135 | LastSwiftMigration = 1100; 136 | }; 137 | }; 138 | }; 139 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 140 | compatibilityVersion = "Xcode 9.3"; 141 | developmentRegion = en; 142 | hasScannedForEncodings = 0; 143 | knownRegions = ( 144 | en, 145 | Base, 146 | ); 147 | mainGroup = 97C146E51CF9000F007C117D; 148 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 149 | projectDirPath = ""; 150 | projectRoot = ""; 151 | targets = ( 152 | 97C146ED1CF9000F007C117D /* Runner */, 153 | ); 154 | }; 155 | /* End PBXProject section */ 156 | 157 | /* Begin PBXResourcesBuildPhase section */ 158 | 97C146EC1CF9000F007C117D /* Resources */ = { 159 | isa = PBXResourcesBuildPhase; 160 | buildActionMask = 2147483647; 161 | files = ( 162 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 163 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 164 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 165 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 166 | ); 167 | runOnlyForDeploymentPostprocessing = 0; 168 | }; 169 | /* End PBXResourcesBuildPhase section */ 170 | 171 | /* Begin PBXShellScriptBuildPhase section */ 172 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 173 | isa = PBXShellScriptBuildPhase; 174 | buildActionMask = 2147483647; 175 | files = ( 176 | ); 177 | inputPaths = ( 178 | ); 179 | name = "Thin Binary"; 180 | outputPaths = ( 181 | ); 182 | runOnlyForDeploymentPostprocessing = 0; 183 | shellPath = /bin/sh; 184 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 185 | }; 186 | 9740EEB61CF901F6004384FC /* Run Script */ = { 187 | isa = PBXShellScriptBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | ); 191 | inputPaths = ( 192 | ); 193 | name = "Run Script"; 194 | outputPaths = ( 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | shellPath = /bin/sh; 198 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 199 | }; 200 | /* End PBXShellScriptBuildPhase section */ 201 | 202 | /* Begin PBXSourcesBuildPhase section */ 203 | 97C146EA1CF9000F007C117D /* Sources */ = { 204 | isa = PBXSourcesBuildPhase; 205 | buildActionMask = 2147483647; 206 | files = ( 207 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 208 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 209 | ); 210 | runOnlyForDeploymentPostprocessing = 0; 211 | }; 212 | /* End PBXSourcesBuildPhase section */ 213 | 214 | /* Begin PBXVariantGroup section */ 215 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 216 | isa = PBXVariantGroup; 217 | children = ( 218 | 97C146FB1CF9000F007C117D /* Base */, 219 | ); 220 | name = Main.storyboard; 221 | sourceTree = ""; 222 | }; 223 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 224 | isa = PBXVariantGroup; 225 | children = ( 226 | 97C147001CF9000F007C117D /* Base */, 227 | ); 228 | name = LaunchScreen.storyboard; 229 | sourceTree = ""; 230 | }; 231 | /* End PBXVariantGroup section */ 232 | 233 | /* Begin XCBuildConfiguration section */ 234 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 235 | isa = XCBuildConfiguration; 236 | buildSettings = { 237 | ALWAYS_SEARCH_USER_PATHS = NO; 238 | CLANG_ANALYZER_NONNULL = YES; 239 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 240 | CLANG_CXX_LIBRARY = "libc++"; 241 | CLANG_ENABLE_MODULES = YES; 242 | CLANG_ENABLE_OBJC_ARC = YES; 243 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 244 | CLANG_WARN_BOOL_CONVERSION = YES; 245 | CLANG_WARN_COMMA = YES; 246 | CLANG_WARN_CONSTANT_CONVERSION = YES; 247 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 248 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 249 | CLANG_WARN_EMPTY_BODY = YES; 250 | CLANG_WARN_ENUM_CONVERSION = YES; 251 | CLANG_WARN_INFINITE_RECURSION = YES; 252 | CLANG_WARN_INT_CONVERSION = YES; 253 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 254 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 255 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 256 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 257 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 258 | CLANG_WARN_STRICT_PROTOTYPES = YES; 259 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 260 | CLANG_WARN_UNREACHABLE_CODE = YES; 261 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 262 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 263 | COPY_PHASE_STRIP = NO; 264 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 265 | ENABLE_NS_ASSERTIONS = NO; 266 | ENABLE_STRICT_OBJC_MSGSEND = YES; 267 | GCC_C_LANGUAGE_STANDARD = gnu99; 268 | GCC_NO_COMMON_BLOCKS = YES; 269 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 270 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 271 | GCC_WARN_UNDECLARED_SELECTOR = YES; 272 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 273 | GCC_WARN_UNUSED_FUNCTION = YES; 274 | GCC_WARN_UNUSED_VARIABLE = YES; 275 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 276 | MTL_ENABLE_DEBUG_INFO = NO; 277 | SDKROOT = iphoneos; 278 | SUPPORTED_PLATFORMS = iphoneos; 279 | TARGETED_DEVICE_FAMILY = "1,2"; 280 | VALIDATE_PRODUCT = YES; 281 | }; 282 | name = Profile; 283 | }; 284 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 285 | isa = XCBuildConfiguration; 286 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 287 | buildSettings = { 288 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 289 | CLANG_ENABLE_MODULES = YES; 290 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 291 | DEVELOPMENT_TEAM = T8U36AZ858; 292 | ENABLE_BITCODE = NO; 293 | INFOPLIST_FILE = Runner/Info.plist; 294 | LD_RUNPATH_SEARCH_PATHS = ( 295 | "$(inherited)", 296 | "@executable_path/Frameworks", 297 | ); 298 | PRODUCT_BUNDLE_IDENTIFIER = dev.dacianflorea.rxdartstatemanagement.rxdartStateManagementArticle; 299 | PRODUCT_NAME = "$(TARGET_NAME)"; 300 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 301 | SWIFT_VERSION = 5.0; 302 | VERSIONING_SYSTEM = "apple-generic"; 303 | }; 304 | name = Profile; 305 | }; 306 | 97C147031CF9000F007C117D /* Debug */ = { 307 | isa = XCBuildConfiguration; 308 | buildSettings = { 309 | ALWAYS_SEARCH_USER_PATHS = NO; 310 | CLANG_ANALYZER_NONNULL = YES; 311 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 312 | CLANG_CXX_LIBRARY = "libc++"; 313 | CLANG_ENABLE_MODULES = YES; 314 | CLANG_ENABLE_OBJC_ARC = YES; 315 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 316 | CLANG_WARN_BOOL_CONVERSION = YES; 317 | CLANG_WARN_COMMA = YES; 318 | CLANG_WARN_CONSTANT_CONVERSION = YES; 319 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 320 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 321 | CLANG_WARN_EMPTY_BODY = YES; 322 | CLANG_WARN_ENUM_CONVERSION = YES; 323 | CLANG_WARN_INFINITE_RECURSION = YES; 324 | CLANG_WARN_INT_CONVERSION = YES; 325 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 326 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 327 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 328 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 329 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 330 | CLANG_WARN_STRICT_PROTOTYPES = YES; 331 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 332 | CLANG_WARN_UNREACHABLE_CODE = YES; 333 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 334 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 335 | COPY_PHASE_STRIP = NO; 336 | DEBUG_INFORMATION_FORMAT = dwarf; 337 | ENABLE_STRICT_OBJC_MSGSEND = YES; 338 | ENABLE_TESTABILITY = YES; 339 | GCC_C_LANGUAGE_STANDARD = gnu99; 340 | GCC_DYNAMIC_NO_PIC = NO; 341 | GCC_NO_COMMON_BLOCKS = YES; 342 | GCC_OPTIMIZATION_LEVEL = 0; 343 | GCC_PREPROCESSOR_DEFINITIONS = ( 344 | "DEBUG=1", 345 | "$(inherited)", 346 | ); 347 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 348 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 349 | GCC_WARN_UNDECLARED_SELECTOR = YES; 350 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 351 | GCC_WARN_UNUSED_FUNCTION = YES; 352 | GCC_WARN_UNUSED_VARIABLE = YES; 353 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 354 | MTL_ENABLE_DEBUG_INFO = YES; 355 | ONLY_ACTIVE_ARCH = YES; 356 | SDKROOT = iphoneos; 357 | TARGETED_DEVICE_FAMILY = "1,2"; 358 | }; 359 | name = Debug; 360 | }; 361 | 97C147041CF9000F007C117D /* Release */ = { 362 | isa = XCBuildConfiguration; 363 | buildSettings = { 364 | ALWAYS_SEARCH_USER_PATHS = NO; 365 | CLANG_ANALYZER_NONNULL = YES; 366 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 367 | CLANG_CXX_LIBRARY = "libc++"; 368 | CLANG_ENABLE_MODULES = YES; 369 | CLANG_ENABLE_OBJC_ARC = YES; 370 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 371 | CLANG_WARN_BOOL_CONVERSION = YES; 372 | CLANG_WARN_COMMA = YES; 373 | CLANG_WARN_CONSTANT_CONVERSION = YES; 374 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 375 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 376 | CLANG_WARN_EMPTY_BODY = YES; 377 | CLANG_WARN_ENUM_CONVERSION = YES; 378 | CLANG_WARN_INFINITE_RECURSION = YES; 379 | CLANG_WARN_INT_CONVERSION = YES; 380 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 381 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 382 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 383 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 384 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 385 | CLANG_WARN_STRICT_PROTOTYPES = YES; 386 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 387 | CLANG_WARN_UNREACHABLE_CODE = YES; 388 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 389 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 390 | COPY_PHASE_STRIP = NO; 391 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 392 | ENABLE_NS_ASSERTIONS = NO; 393 | ENABLE_STRICT_OBJC_MSGSEND = YES; 394 | GCC_C_LANGUAGE_STANDARD = gnu99; 395 | GCC_NO_COMMON_BLOCKS = YES; 396 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 397 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 398 | GCC_WARN_UNDECLARED_SELECTOR = YES; 399 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 400 | GCC_WARN_UNUSED_FUNCTION = YES; 401 | GCC_WARN_UNUSED_VARIABLE = YES; 402 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 403 | MTL_ENABLE_DEBUG_INFO = NO; 404 | SDKROOT = iphoneos; 405 | SUPPORTED_PLATFORMS = iphoneos; 406 | SWIFT_COMPILATION_MODE = wholemodule; 407 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 408 | TARGETED_DEVICE_FAMILY = "1,2"; 409 | VALIDATE_PRODUCT = YES; 410 | }; 411 | name = Release; 412 | }; 413 | 97C147061CF9000F007C117D /* Debug */ = { 414 | isa = XCBuildConfiguration; 415 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 416 | buildSettings = { 417 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 418 | CLANG_ENABLE_MODULES = YES; 419 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 420 | DEVELOPMENT_TEAM = T8U36AZ858; 421 | ENABLE_BITCODE = NO; 422 | INFOPLIST_FILE = Runner/Info.plist; 423 | LD_RUNPATH_SEARCH_PATHS = ( 424 | "$(inherited)", 425 | "@executable_path/Frameworks", 426 | ); 427 | PRODUCT_BUNDLE_IDENTIFIER = dev.dacianflorea.rxdartstatemanagement.rxdartStateManagementArticle; 428 | PRODUCT_NAME = "$(TARGET_NAME)"; 429 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 430 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 431 | SWIFT_VERSION = 5.0; 432 | VERSIONING_SYSTEM = "apple-generic"; 433 | }; 434 | name = Debug; 435 | }; 436 | 97C147071CF9000F007C117D /* Release */ = { 437 | isa = XCBuildConfiguration; 438 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 439 | buildSettings = { 440 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 441 | CLANG_ENABLE_MODULES = YES; 442 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 443 | DEVELOPMENT_TEAM = T8U36AZ858; 444 | ENABLE_BITCODE = NO; 445 | INFOPLIST_FILE = Runner/Info.plist; 446 | LD_RUNPATH_SEARCH_PATHS = ( 447 | "$(inherited)", 448 | "@executable_path/Frameworks", 449 | ); 450 | PRODUCT_BUNDLE_IDENTIFIER = dev.dacianflorea.rxdartstatemanagement.rxdartStateManagementArticle; 451 | PRODUCT_NAME = "$(TARGET_NAME)"; 452 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 453 | SWIFT_VERSION = 5.0; 454 | VERSIONING_SYSTEM = "apple-generic"; 455 | }; 456 | name = Release; 457 | }; 458 | /* End XCBuildConfiguration section */ 459 | 460 | /* Begin XCConfigurationList section */ 461 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 462 | isa = XCConfigurationList; 463 | buildConfigurations = ( 464 | 97C147031CF9000F007C117D /* Debug */, 465 | 97C147041CF9000F007C117D /* Release */, 466 | 249021D3217E4FDB00AE95B9 /* Profile */, 467 | ); 468 | defaultConfigurationIsVisible = 0; 469 | defaultConfigurationName = Release; 470 | }; 471 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 472 | isa = XCConfigurationList; 473 | buildConfigurations = ( 474 | 97C147061CF9000F007C117D /* Debug */, 475 | 97C147071CF9000F007C117D /* Release */, 476 | 249021D4217E4FDB00AE95B9 /* Profile */, 477 | ); 478 | defaultConfigurationIsVisible = 0; 479 | defaultConfigurationName = Release; 480 | }; 481 | /* End XCConfigurationList section */ 482 | }; 483 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 484 | } 485 | --------------------------------------------------------------------------------