diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 270c943..3d6f9ac 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v2 - uses: subosito/flutter-action@v1 with: - flutter-version: "1.22.6" + flutter-version: "2.2.0" - run: flutter pub get - run: flutter analyze - run: flutter test --coverage diff --git a/android/build.gradle b/android/build.gradle index 0baed69..205da3d 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -5,7 +5,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.5.4' + classpath 'com.android.tools.build:gradle:4.0.1' } } diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index dfd5f01..800a762 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip \ No newline at end of file +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip \ No newline at end of file diff --git a/ios/Podfile b/ios/Podfile index 64ba749..a4af0a9 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '9.0' +platform :ios, '9.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' @@ -10,63 +10,29 @@ project 'Runner', { 'Release' => :release, } -def parse_KV_file(file, separator='=') - file_abs_path = File.expand_path(file) - if !File.exists? file_abs_path - return []; +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" end - pods_ary = [] - skip_line_start_symbols = ["#", "/"] - File.foreach(file_abs_path) { |line| - next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } - plugin = line.split(pattern=separator) - if plugin.length == 2 - podname = plugin[0].strip() - path = plugin[1].strip() - podpath = File.expand_path("#{path}", file_abs_path) - pods_ary.push({:name => podname, :path => podpath}); - else - puts "Invalid plugin specification: #{line}" - end - } - return pods_ary + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" end -target 'Runner' do - # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock - # referring to absolute paths on developers' machines. - system('rm -rf .symlinks') - system('mkdir -p .symlinks/plugins') +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) - # Flutter Pods - generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') - if generated_xcode_build_settings.empty? - puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first." - end - generated_xcode_build_settings.map { |p| - if p[:name] == 'FLUTTER_FRAMEWORK_DIR' - symlink = File.join('.symlinks', 'flutter') - File.symlink(File.dirname(p[:path]), symlink) - pod 'Flutter', :path => File.join(symlink, File.basename(p[:path])) - end - } +flutter_ios_podfile_setup - # Plugin Pods - plugin_pods = parse_KV_file('../.flutter-plugins') - plugin_pods.map { |p| - symlink = File.join('.symlinks', 'plugins', p[:name]) - File.symlink(p[:path], symlink) - pod p[:name], :path => File.join(symlink, 'ios') - } +target 'Runner' do + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) end -# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system. -install! 'cocoapods', :disable_input_output_paths => true - post_install do |installer| installer.pods_project.targets.each do |target| - target.build_configurations.each do |config| - config.build_settings['ENABLE_BITCODE'] = 'NO' - end + flutter_additional_ios_build_settings(target) end end diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 5a078b8..eb20ecf 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,22 +1,47 @@ PODS: + - connectivity_plus (0.0.1): + - Flutter + - Reachability - Flutter (1.0.0) + - FMDB (2.7.5): + - FMDB/standard (= 2.7.5) + - FMDB/standard (2.7.5) - path_provider (0.0.1): - Flutter + - Reachability (3.2) + - sqflite (0.0.2): + - Flutter + - FMDB (>= 2.7.5) DEPENDENCIES: - - Flutter (from `.symlinks/flutter/ios`) + - connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`) + - Flutter (from `Flutter`) - path_provider (from `.symlinks/plugins/path_provider/ios`) + - sqflite (from `.symlinks/plugins/sqflite/ios`) + +SPEC REPOS: + trunk: + - FMDB + - Reachability EXTERNAL SOURCES: + connectivity_plus: + :path: ".symlinks/plugins/connectivity_plus/ios" Flutter: - :path: ".symlinks/flutter/ios" + :path: Flutter path_provider: :path: ".symlinks/plugins/path_provider/ios" + sqflite: + :path: ".symlinks/plugins/sqflite/ios" SPEC CHECKSUMS: - Flutter: 58dd7d1b27887414a370fcccb9e645c08ffd7a6a - path_provider: f96fff6166a8867510d2c25fdcc346327cc4b259 + connectivity_plus: 5f0eb61093bec56935f21a1699dd2758bc895587 + Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c + FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a + path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c + Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 + sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 -PODFILE CHECKSUM: 7fb83752f59ead6285236625b82473f90b1cb932 +PODFILE CHECKSUM: b1f7a399522c118a74b177b13c01eca692aa7e6d -COCOAPODS: 1.7.5 +COCOAPODS: 1.10.1 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 897f9a7..7c08b91 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -9,11 +9,7 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; - 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; - 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 5AF2D5218BDD2C8C284A5DBE /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D6FDA03EE42D031CE1B717B /* libPods-Runner.a */; }; - 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; - 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; @@ -29,8 +25,6 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, - 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -41,7 +35,6 @@ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 3D6FDA03EE42D031CE1B717B /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 3F2AF5AB70623481E4CF7187 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; @@ -50,7 +43,6 @@ 7B56FC2819D4B0C020731E02 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; - 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; @@ -65,8 +57,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, - 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 5AF2D5218BDD2C8C284A5DBE /* libPods-Runner.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -88,9 +78,7 @@ 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( - 3B80C3931E831B6300D905FE /* App.framework */, 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, - 9740EEBA1CF902C7004384FC /* Flutter.framework */, 9740EEB21CF90195004384FC /* Debug.xcconfig */, 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 9740EEB31CF90195004384FC /* Generated.xcconfig */, @@ -163,7 +151,6 @@ 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - 6399EC0C6B62ED73848424B3 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -256,22 +243,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; - }; - 6399EC0C6B62ED73848424B3 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; @@ -324,7 +296,6 @@ /* Begin XCBuildConfiguration section */ 249021D3217E4FDB00AE95B9 /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -396,7 +367,6 @@ }; 97C147031CF9000F007C117D /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -450,7 +420,6 @@ }; 97C147041CF9000F007C117D /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; diff --git a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 1d526a1..919434a 100644 --- a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:"> diff --git a/lib/core/injection/register_module.dart b/lib/core/injection/register_module.dart index ed607a5..47896fd 100644 --- a/lib/core/injection/register_module.dart +++ b/lib/core/injection/register_module.dart @@ -11,8 +11,8 @@ abstract class RegisterModule { @lazySingleton GraphQLClient get gqlClient => GraphQLClient( - cache: InMemoryCache(), - link: HttpLink(uri: 'https://rickandmortyapi.com/graphql'), + cache: GraphQLCache(), + link: HttpLink('https://rickandmortyapi.com/graphql'), ); @preResolve diff --git a/lib/features/home/data/datasources/home_remote_datasource.dart b/lib/features/home/data/datasources/home_remote_datasource.dart index cc50eac..59c925d 100644 --- a/lib/features/home/data/datasources/home_remote_datasource.dart +++ b/lib/features/home/data/datasources/home_remote_datasource.dart @@ -1,7 +1,7 @@ import 'package:graphql_flutter/graphql_flutter.dart'; import 'package:injectable/injectable.dart'; -import '../../../../core/error/exceptions.dart'; +import '../../../../core/error/exceptions.dart' as excptn; import '../../../../core/util/gql_query.dart'; import '../models/character_model.dart'; import '../models/episode_model.dart'; @@ -25,7 +25,7 @@ class HomeRemoteDataSource implements IHomeRemoteDataSource { Future> getCharacters(int page) async { try { final result = await _client.query(QueryOptions( - documentNode: gql(GqlQuery.charactersQuery), + document: gql(GqlQuery.charactersQuery), variables: {"page": page}, )); if (result.data == null) { @@ -37,7 +37,7 @@ class HomeRemoteDataSource implements IHomeRemoteDataSource { .toList(); } on Exception catch (exception) { print(exception); - throw ServerException(); + throw excptn.ServerException(); } } @@ -45,7 +45,7 @@ class HomeRemoteDataSource implements IHomeRemoteDataSource { Future> getEpisodes(int page) async { try { final result = await _client.query(QueryOptions( - documentNode: gql(GqlQuery.episodesQuery), + document: gql(GqlQuery.episodesQuery), variables: {"page": page}, )); if (result.data == null) { @@ -57,7 +57,7 @@ class HomeRemoteDataSource implements IHomeRemoteDataSource { .toList(); } on Exception catch (exception) { print(exception); - throw ServerException(); + throw excptn.ServerException(); } } @@ -65,7 +65,7 @@ class HomeRemoteDataSource implements IHomeRemoteDataSource { Future> getLocations(int page) async { try { final result = await _client.query(QueryOptions( - documentNode: gql(GqlQuery.locationsQuery), + document: gql(GqlQuery.locationsQuery), variables: {"page": page}, )); if (result.data == null) { @@ -77,7 +77,7 @@ class HomeRemoteDataSource implements IHomeRemoteDataSource { .toList(); } on Exception catch (exception) { print(exception); - throw ServerException(); + throw excptn.ServerException(); } } } diff --git a/pubspec.lock b/pubspec.lock index e105c4b..f0c74f5 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,14 +7,14 @@ packages: name: _fe_analyzer_shared url: "https://pub.dartlang.org" source: hosted - version: "12.0.0" + version: "22.0.0" analyzer: dependency: transitive description: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "0.40.6" + version: "1.7.1" ant_icons: dependency: "direct main" description: @@ -28,35 +28,35 @@ packages: name: archive url: "https://pub.dartlang.org" source: hosted - version: "2.0.13" + version: "3.1.2" args: dependency: transitive description: name: args url: "https://pub.dartlang.org" source: hosted - version: "1.6.0" + version: "2.1.1" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0" + version: "2.6.1" bloc: - dependency: "direct main" + dependency: transitive description: name: bloc url: "https://pub.dartlang.org" source: hosted - version: "6.1.3" + version: "7.0.0" bloc_test: dependency: "direct dev" description: name: bloc_test url: "https://pub.dartlang.org" source: hosted - version: "7.1.0" + version: "8.0.2" boolean_selector: dependency: transitive description: @@ -70,42 +70,42 @@ packages: name: build url: "https://pub.dartlang.org" source: hosted - version: "1.6.2" + version: "2.0.2" build_config: dependency: transitive description: name: build_config url: "https://pub.dartlang.org" source: hosted - version: "0.4.5" + version: "1.0.0" build_daemon: dependency: transitive description: name: build_daemon url: "https://pub.dartlang.org" source: hosted - version: "2.1.8" + version: "3.0.0" build_resolvers: dependency: transitive description: name: build_resolvers url: "https://pub.dartlang.org" source: hosted - version: "1.5.3" + version: "2.0.3" build_runner: dependency: "direct dev" description: name: build_runner url: "https://pub.dartlang.org" source: hosted - version: "1.11.1" + version: "2.0.4" build_runner_core: dependency: transitive description: name: build_runner_core url: "https://pub.dartlang.org" source: hosted - version: "6.1.7" + version: "7.0.0" built_collection: dependency: transitive description: @@ -126,7 +126,7 @@ packages: name: cached_network_image url: "https://pub.dartlang.org" source: hosted - version: "2.5.0" + version: "3.0.0" characters: dependency: transitive description: @@ -147,14 +147,14 @@ packages: name: checked_yaml url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "2.0.1" cli_util: dependency: transitive description: name: cli_util url: "https://pub.dartlang.org" source: hosted - version: "0.2.0" + version: "0.3.0" clock: dependency: transitive description: @@ -168,7 +168,7 @@ packages: name: code_builder url: "https://pub.dartlang.org" source: hosted - version: "3.6.0" + version: "4.0.0" collection: dependency: transitive description: @@ -176,62 +176,76 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.15.0" - connectivity: + connectivity_plus: + dependency: transitive + description: + name: connectivity_plus + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" + connectivity_plus_linux: dependency: transitive description: - name: connectivity + name: connectivity_plus_linux url: "https://pub.dartlang.org" source: hosted - version: "0.4.9+5" - connectivity_for_web: + version: "1.0.2" + connectivity_plus_macos: dependency: transitive description: - name: connectivity_for_web + name: connectivity_plus_macos url: "https://pub.dartlang.org" source: hosted - version: "0.3.1+4" - connectivity_macos: + version: "1.0.2" + connectivity_plus_platform_interface: dependency: transitive description: - name: connectivity_macos + name: connectivity_plus_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "0.1.0+7" - connectivity_platform_interface: + version: "1.0.2" + connectivity_plus_web: dependency: transitive description: - name: connectivity_platform_interface + name: connectivity_plus_web url: "https://pub.dartlang.org" source: hosted - version: "1.0.6" + version: "1.0.2" + connectivity_plus_windows: + dependency: transitive + description: + name: connectivity_plus_windows + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" convert: dependency: transitive description: name: convert url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "3.0.0" coverage: dependency: transitive description: name: coverage url: "https://pub.dartlang.org" source: hosted - version: "0.15.2" + version: "1.0.3" crypto: dependency: transitive description: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "2.1.5" + version: "3.0.1" dart_style: dependency: transitive description: name: dart_style url: "https://pub.dartlang.org" source: hosted - version: "1.3.10" + version: "2.0.1" dartz: dependency: "direct main" description: @@ -246,6 +260,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.3.4" + dbus: + dependency: transitive + description: + name: dbus + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.5" effective_dart: dependency: "direct dev" description: @@ -273,7 +294,7 @@ packages: name: file url: "https://pub.dartlang.org" source: hosted - version: "5.2.1" + version: "6.1.1" fixnum: dependency: transitive description: @@ -292,21 +313,21 @@ packages: name: flutter_bloc url: "https://pub.dartlang.org" source: hosted - version: "6.1.3" + version: "7.0.1" flutter_blurhash: dependency: transitive description: name: flutter_blurhash url: "https://pub.dartlang.org" source: hosted - version: "0.5.0" + version: "0.6.0" flutter_cache_manager: dependency: transitive description: name: flutter_cache_manager url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "3.1.1" flutter_test: dependency: "direct dev" description: flutter @@ -323,119 +344,161 @@ packages: name: freezed url: "https://pub.dartlang.org" source: hosted - version: "0.12.7" + version: "0.14.2" freezed_annotation: dependency: "direct main" description: name: freezed_annotation url: "https://pub.dartlang.org" source: hosted - version: "0.12.0" + version: "0.14.2" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" get_it: dependency: "direct main" description: name: get_it url: "https://pub.dartlang.org" source: hosted - version: "5.0.6" + version: "7.1.3" glob: dependency: transitive description: name: glob url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "2.0.1" gql: dependency: transitive description: name: gql url: "https://pub.dartlang.org" source: hosted - version: "0.12.4" + version: "0.13.0" + gql_dedupe_link: + dependency: transitive + description: + name: gql_dedupe_link + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" + gql_error_link: + dependency: transitive + description: + name: gql_error_link + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.0" + gql_exec: + dependency: transitive + description: + name: gql_exec + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.0" + gql_http_link: + dependency: transitive + description: + name: gql_http_link + url: "https://pub.dartlang.org" + source: hosted + version: "0.4.0" + gql_link: + dependency: transitive + description: + name: gql_link + url: "https://pub.dartlang.org" + source: hosted + version: "0.4.0" + gql_transform_link: + dependency: transitive + description: + name: gql_transform_link + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.0" graphql: dependency: transitive description: name: graphql url: "https://pub.dartlang.org" source: hosted - version: "3.1.0" + version: "5.0.0" graphql_flutter: dependency: "direct main" description: name: graphql_flutter url: "https://pub.dartlang.org" source: hosted - version: "3.1.0" + version: "5.0.0" graphs: dependency: transitive description: name: graphs url: "https://pub.dartlang.org" source: hosted - version: "0.2.0" + version: "2.0.0" hive: dependency: "direct main" description: name: hive url: "https://pub.dartlang.org" source: hosted - version: "1.4.4+1" + version: "2.0.4" http: dependency: transitive description: name: http url: "https://pub.dartlang.org" source: hosted - version: "0.12.2" + version: "0.13.3" http_multi_server: dependency: transitive description: name: http_multi_server url: "https://pub.dartlang.org" source: hosted - version: "2.2.0" + version: "3.0.1" http_parser: dependency: transitive description: name: http_parser url: "https://pub.dartlang.org" source: hosted - version: "3.1.4" + version: "4.0.0" image: dependency: transitive description: name: image url: "https://pub.dartlang.org" source: hosted - version: "2.1.19" + version: "3.0.2" injectable: dependency: "direct main" description: name: injectable url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.4.1" injectable_generator: dependency: "direct dev" description: name: injectable_generator url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" - intl: - dependency: transitive - description: - name: intl - url: "https://pub.dartlang.org" - source: hosted - version: "0.16.1" + version: "1.4.1" io: dependency: transitive description: name: io url: "https://pub.dartlang.org" source: hosted - version: "0.3.5" + version: "1.0.0" js: dependency: transitive description: @@ -449,14 +512,14 @@ packages: name: json_annotation url: "https://pub.dartlang.org" source: hosted - version: "3.1.1" + version: "4.0.1" json_serializable: dependency: "direct main" description: name: json_serializable url: "https://pub.dartlang.org" source: hosted - version: "3.5.1" + version: "4.1.3" logging: dependency: transitive description: @@ -484,14 +547,14 @@ packages: name: mime url: "https://pub.dartlang.org" source: hosted - version: "0.9.7" - mockito: + version: "1.0.0" + mocktail: dependency: "direct dev" description: - name: mockito + name: mocktail url: "https://pub.dartlang.org" source: hosted - version: "4.1.4" + version: "0.1.4" nested: dependency: transitive description: @@ -499,48 +562,41 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.0" - node_interop: - dependency: transitive - description: - name: node_interop - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.1" - node_io: + node_preamble: dependency: transitive description: - name: node_io + name: node_preamble url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" - node_preamble: + version: "2.0.0" + normalize: dependency: transitive description: - name: node_preamble + name: normalize url: "https://pub.dartlang.org" source: hosted - version: "1.4.13" + version: "0.5.3" octo_image: dependency: transitive description: name: octo_image url: "https://pub.dartlang.org" source: hosted - version: "0.3.0" + version: "1.0.0+1" package_config: dependency: transitive description: name: package_config url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "2.0.0" pagination_view: dependency: "direct main" description: name: pagination_view url: "https://pub.dartlang.org" source: hosted - version: "1.0.4+2" + version: "2.0.0" path: dependency: transitive description: @@ -554,35 +610,35 @@ packages: name: path_provider url: "https://pub.dartlang.org" source: hosted - version: "1.6.27" + version: "2.0.2" path_provider_linux: dependency: transitive description: name: path_provider_linux url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+2" + version: "2.0.0" path_provider_macos: dependency: transitive description: name: path_provider_macos url: "https://pub.dartlang.org" source: hosted - version: "0.0.4+8" + version: "2.0.0" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "2.0.1" path_provider_windows: dependency: transitive description: name: path_provider_windows url: "https://pub.dartlang.org" source: hosted - version: "0.0.5" + version: "2.0.1" pedantic: dependency: transitive description: @@ -596,7 +652,7 @@ packages: name: petitparser url: "https://pub.dartlang.org" source: hosted - version: "3.1.0" + version: "4.1.0" platform: dependency: transitive description: @@ -610,7 +666,7 @@ packages: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.3" + version: "2.0.0" pool: dependency: transitive description: @@ -624,70 +680,63 @@ packages: name: process url: "https://pub.dartlang.org" source: hosted - version: "3.0.13" + version: "4.2.1" provider: dependency: transitive description: name: provider url: "https://pub.dartlang.org" source: hosted - version: "4.3.3" + version: "5.0.0" pub_semver: dependency: transitive description: name: pub_semver url: "https://pub.dartlang.org" source: hosted - version: "1.4.4" + version: "2.0.0" pubspec_parse: dependency: transitive description: name: pubspec_parse url: "https://pub.dartlang.org" source: hosted - version: "0.1.8" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.5" + version: "1.0.0" rxdart: dependency: "direct main" description: name: rxdart url: "https://pub.dartlang.org" source: hosted - version: "0.24.1" + version: "0.26.0" shelf: dependency: transitive description: name: shelf url: "https://pub.dartlang.org" source: hosted - version: "0.7.9" + version: "1.1.4" shelf_packages_handler: dependency: transitive description: name: shelf_packages_handler url: "https://pub.dartlang.org" source: hosted - version: "2.0.1" + version: "3.0.0" shelf_static: dependency: transitive description: name: shelf_static url: "https://pub.dartlang.org" source: hosted - version: "0.2.9+2" + version: "1.0.0" shelf_web_socket: dependency: transitive description: name: shelf_web_socket url: "https://pub.dartlang.org" source: hosted - version: "0.2.4+1" + version: "1.0.1" sky_engine: dependency: transitive description: flutter @@ -699,7 +748,7 @@ packages: name: source_gen url: "https://pub.dartlang.org" source: hosted - version: "0.9.10+2" + version: "1.0.1" source_map_stack_trace: dependency: transitive description: @@ -720,21 +769,21 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.1" sqflite: dependency: transitive description: name: sqflite url: "https://pub.dartlang.org" source: hosted - version: "1.3.2+4" + version: "2.0.0+3" sqflite_common: dependency: transitive description: name: sqflite_common url: "https://pub.dartlang.org" source: hosted - version: "1.0.3+1" + version: "2.0.0+2" stack_trace: dependency: transitive description: @@ -769,7 +818,7 @@ packages: name: synchronized url: "https://pub.dartlang.org" source: hosted - version: "2.2.0+2" + version: "3.0.0" term_glyph: dependency: transitive description: @@ -783,28 +832,28 @@ packages: name: test url: "https://pub.dartlang.org" source: hosted - version: "1.16.5" + version: "1.16.8" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19" + version: "0.3.0" test_core: dependency: transitive description: name: test_core url: "https://pub.dartlang.org" source: hosted - version: "0.3.15" + version: "0.3.19" timing: dependency: transitive description: name: timing url: "https://pub.dartlang.org" source: hosted - version: "0.1.1+3" + version: "1.0.0" typed_data: dependency: transitive description: @@ -818,14 +867,7 @@ packages: name: uuid url: "https://pub.dartlang.org" source: hosted - version: "2.2.2" - uuid_enhanced: - dependency: transitive - description: - name: uuid_enhanced - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.2" + version: "3.0.4" vector_math: dependency: transitive description: @@ -846,14 +888,14 @@ packages: name: watcher url: "https://pub.dartlang.org" source: hosted - version: "0.9.7+15" + version: "1.0.0" web_socket_channel: dependency: transitive description: name: web_socket_channel url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "2.1.0" webkit_inspection_protocol: dependency: transitive description: @@ -861,13 +903,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.0" - websocket: - dependency: transitive - description: - name: websocket - url: "https://pub.dartlang.org" - source: hosted - version: "0.0.5" win32: dependency: transitive description: @@ -881,21 +916,21 @@ packages: name: xdg_directories url: "https://pub.dartlang.org" source: hosted - version: "0.1.2" + version: "0.2.0" xml: dependency: transitive description: name: xml url: "https://pub.dartlang.org" source: hosted - version: "4.5.1" + version: "5.1.2" yaml: dependency: transitive description: name: yaml url: "https://pub.dartlang.org" source: hosted - version: "2.2.1" + version: "3.1.0" sdks: - dart: ">=2.12.0-259.9.beta <3.0.0" - flutter: ">=1.22.2" + dart: ">=2.12.0 <3.0.0" + flutter: ">=1.24.0-10.2.pre" diff --git a/pubspec.yaml b/pubspec.yaml index ddb1f92..647e0c1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,49 +11,48 @@ dependencies: sdk: flutter # UI - pagination_view: ^1.0.4+2 + pagination_view: ^2.0.0 ant_icons: ^1.0.0 - cached_network_image: ^2.3.2+1 + cached_network_image: ^3.0.0 # Network - graphql_flutter: ^3.1.0 + graphql_flutter: ^5.0.0 data_connection_checker: ^0.3.4 # Dart data class - json_serializable: ^3.5.1 - freezed_annotation: ^0.12.0 + json_serializable: ^4.1.3 + freezed_annotation: ^0.14.2 # Dependency Injection - get_it: ^5.0.6 + get_it: ^7.1.3 injectable: ^1.0.4 # State management - bloc: ^6.1.3 - flutter_bloc: ^6.1.3 + flutter_bloc: ^7.0.1 # Caching - hive: ^1.4.4+1 + hive: ^2.0.4 # Misc dartz: ^0.9.2 - rxdart: ^0.24.1 - path_provider: ^1.6.27 + rxdart: ^0.26.0 + path_provider: ^2.0.2 dev_dependencies: flutter_test: sdk: flutter # Code generators - freezed: ^0.12.1 - injectable_generator: ^1.0.4 - build_runner: ^1.10.1 + freezed: ^0.14.2 + injectable_generator: ^1.4.1 + build_runner: ^2.0.4 # Linting effective_dart: ^1.3.0 # Testing - bloc_test: ^7.1.0 - mockito: ^4.1.1 + bloc_test: ^8.0.2 + mocktail: ^0.1.4 flutter: uses-material-design: true diff --git a/test/features/home/data/repositories/home_repository_test.dart b/test/features/home/data/repositories/home_repository_test.dart index b7b8f28..47a1b51 100644 --- a/test/features/home/data/repositories/home_repository_test.dart +++ b/test/features/home/data/repositories/home_repository_test.dart @@ -1,6 +1,6 @@ import 'package:dartz/dartz.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:mockito/mockito.dart'; +import 'package:mocktail/mocktail.dart'; import 'package:rick_and_morty_info/core/error/exceptions.dart'; import 'package:rick_and_morty_info/core/error/failures.dart'; import 'package:rick_and_morty_info/core/network/network_info.dart'; @@ -38,7 +38,7 @@ void main() { void runTestsOnline(Function body) { group('device is online', () { setUp(() { - when(mockNetworkInfo.isConnected).thenAnswer((_) async => true); + when(() => mockNetworkInfo.isConnected).thenAnswer((_) async => true); }); body(); @@ -48,7 +48,7 @@ void main() { void runTestsOffline(Function body) { group('device is offline', () { setUp(() { - when(mockNetworkInfo.isConnected).thenAnswer((_) async => false); + when(() => mockNetworkInfo.isConnected).thenAnswer((_) async => false); }); body(); @@ -82,19 +82,19 @@ void main() { test('should check if the device is online', () async { // arrange - when(mockNetworkInfo.isConnected).thenAnswer((_) async => true); - when(mockRemoteDataSource.getCharacters(tPage)) + when(() => mockNetworkInfo.isConnected).thenAnswer((_) async => true); + when(() => mockRemoteDataSource.getCharacters(tPage)) .thenAnswer((_) async => await tCharacterModels); // act await repository.getCharacters(tPage); // assert - verify(mockNetworkInfo.isConnected); + verify(() => mockNetworkInfo.isConnected); }); runTestsOnline(() { test('should get characters when page number is passed', () async { // arrange - when(mockRemoteDataSource.getCharacters(tPage)) + when(() => mockRemoteDataSource.getCharacters(tPage)) .thenAnswer((_) async => await tCharacterModels); // act final result = await repository.getCharacters(tPage); @@ -104,23 +104,24 @@ void main() { test('should cache characters when remote data is recieved', () async { // arrange - when(mockRemoteDataSource.getCharacters(tPage)) + when(() => mockRemoteDataSource.getCharacters(tPage)) .thenAnswer((_) async => await tCharacterModels); // act await repository.getCharacters(tPage); // assert - verify(mockRemoteDataSource.getCharacters(tPage)); - verify(mockLocalDataSource.cacheCharacters(tCharacterModels, tPage)); + verify(() => mockRemoteDataSource.getCharacters(tPage)); + verify( + () => mockLocalDataSource.cacheCharacters(tCharacterModels, tPage)); }); test('should return failure when there is an exception', () async { // arrange - when(mockRemoteDataSource.getCharacters(tPage)) + when(() => mockRemoteDataSource.getCharacters(tPage)) .thenThrow(ServerException()); // act final result = await repository.getCharacters(tPage); // assert - verify(mockRemoteDataSource.getCharacters(tPage)); + verify(() => mockRemoteDataSource.getCharacters(tPage)); verifyZeroInteractions(mockLocalDataSource); expect(result, isA>>()); }); @@ -129,7 +130,7 @@ void main() { runTestsOffline(() { test('should return cached data when cache is hit', () async { // arrange - when(mockLocalDataSource.getLastCharacters(tPage)) + when(() => mockLocalDataSource.getLastCharacters(tPage)) .thenReturn(tCharacterModels); // act final result = await repository.getCharacters(tPage); @@ -139,7 +140,7 @@ void main() { test('should return cache failure when cache is miss', () async { // arrange - when(mockLocalDataSource.getLastCharacters(tPage)) + when(() => mockLocalDataSource.getLastCharacters(tPage)) .thenThrow(CacheException()); // act final result = await repository.getCharacters(tPage); diff --git a/test/features/home/domain/usecases/get_characters_usecase_test.dart b/test/features/home/domain/usecases/get_characters_usecase_test.dart index fad815f..6b53ffd 100644 --- a/test/features/home/domain/usecases/get_characters_usecase_test.dart +++ b/test/features/home/domain/usecases/get_characters_usecase_test.dart @@ -1,6 +1,6 @@ import 'package:dartz/dartz.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:mockito/mockito.dart'; +import 'package:mocktail/mocktail.dart'; import 'package:rick_and_morty_info/core/types/gender.dart'; import 'package:rick_and_morty_info/core/types/vital_status.dart'; import 'package:rick_and_morty_info/features/home/domain/entities/character.dart'; @@ -32,7 +32,7 @@ void main() { test('should return list of characters when requested with offset', () async { // arrange - when(mockRepository.getCharacters(tPage)) + when(() => mockRepository.getCharacters(tPage)) .thenAnswer((_) async => await Right(tCharacters)); // act final result = await usecase(CharacterParams(tPage)); diff --git a/test/features/home/domain/usecases/get_episodes_usecase_test.dart b/test/features/home/domain/usecases/get_episodes_usecase_test.dart index e07dcad..a99bc31 100644 --- a/test/features/home/domain/usecases/get_episodes_usecase_test.dart +++ b/test/features/home/domain/usecases/get_episodes_usecase_test.dart @@ -1,6 +1,6 @@ import 'package:dartz/dartz.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:mockito/mockito.dart'; +import 'package:mocktail/mocktail.dart'; import 'package:rick_and_morty_info/features/home/domain/entities/episode.dart'; import 'package:rick_and_morty_info/features/home/domain/repositories/i_home_repository.dart'; import 'package:rick_and_morty_info/features/home/domain/usecases/get_episodes_usecase.dart'; @@ -28,7 +28,7 @@ void main() { test('should return list of episodes when requested with offset', () async { // arrange - when(mockRepository.getEpisodes(tPage)) + when(() => mockRepository.getEpisodes(tPage)) .thenAnswer((_) async => await Right(tEpisodes)); // act final result = await usecase(EpisodeParams(tPage)); diff --git a/test/features/home/domain/usecases/get_locations_usecase_test.dart b/test/features/home/domain/usecases/get_locations_usecase_test.dart index c3529b2..fb030cd 100644 --- a/test/features/home/domain/usecases/get_locations_usecase_test.dart +++ b/test/features/home/domain/usecases/get_locations_usecase_test.dart @@ -1,6 +1,7 @@ import 'package:dartz/dartz.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:mockito/mockito.dart'; +import 'package:mocktail/mocktail.dart'; + import 'package:rick_and_morty_info/features/home/domain/entities/location.dart'; import 'package:rick_and_morty_info/features/home/domain/repositories/i_home_repository.dart'; import 'package:rick_and_morty_info/features/home/domain/usecases/get_locations_usecase.dart'; @@ -28,7 +29,7 @@ void main() { test('should return list of locations when requested with offset', () async { // arrange - when(mockRepository.getLocations(tPage)) + when(() => mockRepository.getLocations(tPage)) .thenAnswer((_) async => await Right(tLocations)); // act final result = await usecase(LocationParams(tPage));