diff --git a/.circleci/config.yml b/.circleci/config.yml index ac396bca5..f1b4eb4b7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -40,14 +40,14 @@ jobs: background: true - run: name: download flutter SDK - command: if ! test -f "~/flutter_sdk.zip"; then curl -o ~/flutter_sdk.zip https://storage.googleapis.com/flutter_infra/releases/stable/macos/flutter_macos_1.20.4-stable.zip; fi + command: if ! test -f "~/flutter_sdk.zip"; then curl -o ~/flutter_sdk.zip https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_2.2.3-stable.zip; fi - run: name: unzip flutter SDK command: unzip ~/flutter_sdk.zip -d ~ - run: flutter doctor - run: name: Flutter build - command: cd ..; flutter build aot + command: cd ..; flutter build apk - run: name: Download Android Dependencies command: ./gradlew androidDependencies @@ -86,7 +86,7 @@ jobs: command: sudo gem install cocoapods - run: name: download flutter SDK - command: if ! test -f "~/flutter_sdk.zip"; then curl -o ~/flutter_sdk.zip https://storage.googleapis.com/flutter_infra/releases/stable/macos/flutter_macos_1.20.4-stable.zip; fi + command: if ! test -f "~/flutter_sdk.zip"; then curl -o ~/flutter_sdk.zip https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_2.2.3-stable.zip; fi - run: name: unzip flutter SDK command: unzip ~/flutter_sdk.zip -d ~ @@ -98,9 +98,6 @@ jobs: - run: name: Install Pods command: cd ios && pod install --repo-update - - run: - name: Flutter build - command: flutter build aot - run: name: Build and run tests command: cd ios && xcodebuild -allowProvisioningUpdates -workspace Runner.xcworkspace -scheme Runner -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 12 Pro Max,OS=14.3' test | xcpretty diff --git a/Dangerfile b/Dangerfile index e3e9ad9b5..582d1e229 100644 --- a/Dangerfile +++ b/Dangerfile @@ -8,5 +8,5 @@ if github.pr_body.length < 3 && git.lines_of_code > 10 end if !git.modified_files.include?("CHANGELOG.md") && !declared_trivial - fail("Please include a CHANGELOG entry. \nYou can find it at [CHANGELOG.md](https://github.com/Instabug/Instabug-Flutter/blob/master/CHANGELOG.md).", sticky: false) + warn("Please include a CHANGELOG entry. \nYou can find it at [CHANGELOG.md](https://github.com/Instabug/Instabug-Flutter/blob/master/CHANGELOG.md).", sticky: false) end diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index bc82f6acd..852f6efb0 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -23,11 +23,11 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/instabug_flutter/ios" SPEC CHECKSUMS: - Flutter: 0e3d915762c693b495b44d77113d4970485de6ec + Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c Instabug: 28838c071edc50e4f13800e6877645d3b328aab9 instabug_flutter: 65794e9f82acebde599e56cc6a2e74a17b69410e OCMock: 5ea90566be239f179ba766fd9fbae5885040b992 PODFILE CHECKSUM: 082ec096394aa5e2e9254f7b7845847607911bda -COCOAPODS: 1.9.1 +COCOAPODS: 1.10.1 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index f63e6d88b..ead2cbc4d 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -607,6 +607,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = 56S6Q9SA8U; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -621,7 +622,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = com.example.InstabugSample; + PRODUCT_BUNDLE_IDENTIFIER = com.instabug.InstabugSample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; @@ -743,6 +744,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = 56S6Q9SA8U; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -757,7 +759,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = com.example.InstabugSample; + PRODUCT_BUNDLE_IDENTIFIER = com.instabug.InstabugSample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -773,6 +775,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = 56S6Q9SA8U; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -787,7 +790,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = com.example.InstabugSample; + PRODUCT_BUNDLE_IDENTIFIER = com.instabug.InstabugSample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; @@ -808,7 +811,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = C3ZD2T892Z; + DEVELOPMENT_TEAM = 56S6Q9SA8U; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = InstabugSampleTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.3; @@ -839,7 +842,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = C3ZD2T892Z; + DEVELOPMENT_TEAM = 56S6Q9SA8U; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = InstabugSampleTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.3; @@ -869,7 +872,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = C3ZD2T892Z; + DEVELOPMENT_TEAM = 56S6Q9SA8U; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = InstabugSampleTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.3; @@ -898,7 +901,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = C3ZD2T892Z; + DEVELOPMENT_TEAM = 56S6Q9SA8U; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = InstabugSampleUITests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.3; @@ -928,7 +931,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = C3ZD2T892Z; + DEVELOPMENT_TEAM = 56S6Q9SA8U; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = InstabugSampleUITests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.3; @@ -957,7 +960,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = C3ZD2T892Z; + DEVELOPMENT_TEAM = 56S6Q9SA8U; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = InstabugSampleUITests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.3; diff --git a/example/lib/main.dart b/example/lib/main.dart index 874ab25dd..ae838d711 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -9,7 +9,7 @@ import 'package:instabug_flutter/Surveys.dart'; void main() { FlutterError.onError = (FlutterErrorDetails details) { - Zone.current.handleUncaughtError(details.exception, details.stack); + Zone.current.handleUncaughtError(details.exception, details.stack!); }; runZonedGuarded(() => runApp(MyApp()), CrashReporting.reportCrash); @@ -46,7 +46,7 @@ class MyApp extends StatelessWidget { } class MyHomePage extends StatefulWidget { - const MyHomePage({Key key, this.title}) : super(key: key); + const MyHomePage({Key? key, required this.title}) : super(key: key); // This widget is the home page of your application. It is stateful, meaning // that it has a State object (defined below) that contains fields that affect diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 540f440a0..4095e5016 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: ">=2.7.0 <3.0.0" + sdk: ">=2.12.0 <3.0.0" dependencies: flutter: diff --git a/ios/Classes/InstabugFlutterPlugin.m b/ios/Classes/InstabugFlutterPlugin.m index 8f60cad0d..e61279d65 100644 --- a/ios/Classes/InstabugFlutterPlugin.m +++ b/ios/Classes/InstabugFlutterPlugin.m @@ -43,8 +43,6 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { [inv getReturnValue:&returnVal]; NSObject *resultSet = (__bridge NSObject *)returnVal; result(resultSet); - } else { - result(nil); } } if (!isImplemented) { diff --git a/lib/BugReporting.dart b/lib/BugReporting.dart index 64a6e1120..2b6eb5623 100644 --- a/lib/BugReporting.dart +++ b/lib/BugReporting.dart @@ -28,8 +28,8 @@ class BugReporting { static Function? _onDismissCallback; static const MethodChannel _channel = MethodChannel('instabug_flutter'); - static Future get platformVersion async => - (await _channel.invokeMethod('getPlatformVersion'))!; + static Future get platformVersion async => + await _channel.invokeMethod('getPlatformVersion'); static Future _handleMethod(MethodCall call) async { switch (call.method) { diff --git a/lib/Chats.dart b/lib/Chats.dart index d4a8e9953..8829915b9 100644 --- a/lib/Chats.dart +++ b/lib/Chats.dart @@ -7,8 +7,8 @@ import 'package:flutter/services.dart'; class Chats { static const MethodChannel _channel = MethodChannel('instabug_flutter'); - static Future get platformVersion async => - (await _channel.invokeMethod('getPlatformVersion'))!; + static Future get platformVersion async => + await _channel.invokeMethod('getPlatformVersion'); @deprecated diff --git a/lib/CrashReporting.dart b/lib/CrashReporting.dart index 19bad4ca3..830236caa 100644 --- a/lib/CrashReporting.dart +++ b/lib/CrashReporting.dart @@ -13,8 +13,8 @@ import 'package:stack_trace/stack_trace.dart'; class CrashReporting { static const MethodChannel _channel = MethodChannel('instabug_flutter'); static bool enabled = true; - static Future get platformVersion async => - (await _channel.invokeMethod('getPlatformVersion'))!; + static Future get platformVersion async => + await _channel.invokeMethod('getPlatformVersion'); ///Enables and disables Enables and disables automatic crash reporting. /// [boolean] isEnabled @@ -38,11 +38,7 @@ class CrashReporting { /// [StackTrace] stack static Future reportHandledCrash(dynamic exception, [StackTrace? stack]) async { - if (stack != null) { - _sendCrash(exception, stack, true); - } else { - _sendCrash(exception, StackTrace.current, true); - } + _sendCrash(exception, stack ?? StackTrace.current, true); } static Future _reportUnhandledCrash( @@ -59,7 +55,7 @@ class CrashReporting { trace.frames[i].uri.toString(), trace.frames[i].member, trace.frames[i].line, - trace.frames[i].column == null ? 0 : trace.frames[i].column!)); + trace.frames[i].column ?? 0)); } final CrashData crashData = CrashData( exception.toString(), Platform.operatingSystem.toString(), frames); diff --git a/lib/FeatureRequests.dart b/lib/FeatureRequests.dart index 0bee780be..ff8493054 100644 --- a/lib/FeatureRequests.dart +++ b/lib/FeatureRequests.dart @@ -9,8 +9,8 @@ enum ActionType { requestNewFeature, addCommentToFeature } class FeatureRequests { static const MethodChannel _channel = MethodChannel('instabug_flutter'); - static Future get platformVersion async => - (await _channel.invokeMethod('getPlatformVersion'))!; + static Future get platformVersion async => + await _channel.invokeMethod('getPlatformVersion'); ///Shows the UI for feature requests list static Future show() async { diff --git a/lib/Instabug.dart b/lib/Instabug.dart index 1743070d2..2a3e50d43 100644 --- a/lib/Instabug.dart +++ b/lib/Instabug.dart @@ -90,8 +90,8 @@ enum ReproStepsMode { enabled, disabled, enabledWithNoScreenshots } class Instabug { static const MethodChannel _channel = MethodChannel('instabug_flutter'); - static Future get platformVersion async => - (await _channel.invokeMethod('getPlatformVersion'))!; + static Future get platformVersion async => + await _channel.invokeMethod('getPlatformVersion'); /// Starts the SDK. /// This is the main SDK method that does all the magic. This is the only diff --git a/lib/InstabugLog.dart b/lib/InstabugLog.dart index eedf195b0..61b11492e 100644 --- a/lib/InstabugLog.dart +++ b/lib/InstabugLog.dart @@ -7,8 +7,8 @@ import 'package:flutter/services.dart'; class InstabugLog { static const MethodChannel _channel = MethodChannel('instabug_flutter'); - static Future get platformVersion async => - (await _channel.invokeMethod('getPlatformVersion'))!; + static Future get platformVersion async => + await _channel.invokeMethod('getPlatformVersion'); /// Appends a log [message] to Instabug internal log /// These logs are then sent along the next uploaded report. diff --git a/lib/NetworkLogger.dart b/lib/NetworkLogger.dart index 3fd3e2a96..6b9fbc038 100644 --- a/lib/NetworkLogger.dart +++ b/lib/NetworkLogger.dart @@ -8,8 +8,8 @@ import 'package:instabug_flutter/models/network_data.dart'; class NetworkLogger { static const MethodChannel _channel = MethodChannel('instabug_flutter'); - static Future get platformVersion async => - (await _channel.invokeMethod('getPlatformVersion'))!; + static Future get platformVersion async => + await _channel.invokeMethod('getPlatformVersion'); static Future networkLog(NetworkData data) async { final params = [data.toMap()]; diff --git a/lib/Replies.dart b/lib/Replies.dart index def38ead4..b583a9850 100644 --- a/lib/Replies.dart +++ b/lib/Replies.dart @@ -11,8 +11,8 @@ class Replies { static Function? _unreadRepliesCountCallback; static const MethodChannel _channel = MethodChannel('instabug_flutter'); - static Future get platformVersion async => - (await _channel.invokeMethod('getPlatformVersion'))!; + static Future get platformVersion async => + await _channel.invokeMethod('getPlatformVersion'); static Future _handleMethod(MethodCall call) async { switch (call.method) { diff --git a/lib/Surveys.dart b/lib/Surveys.dart index 2ef8b70c4..ec004260a 100644 --- a/lib/Surveys.dart +++ b/lib/Surveys.dart @@ -12,8 +12,8 @@ class Surveys { static Function? _hasRespondedToSurveyCallback; static const MethodChannel _channel = MethodChannel('instabug_flutter'); - static Future get platformVersion async => - (await _channel.invokeMethod('getPlatformVersion'))!; + static Future get platformVersion async => + await _channel.invokeMethod('getPlatformVersion'); static Future _handleMethod(MethodCall call) async { switch (call.method) { diff --git a/pubspec.yaml b/pubspec.yaml index d3e91c77c..9ee44d7ae 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,12 +1,8 @@ name: instabug_flutter -version: 10.0.0 +version: 9.2.0-nullsafety.0 description: >- - Instabug is an in-app feedback and bug reporting tool for mobile apps. - With just a simple shake, your users or beta testers can report bugs or - send in-app feedback and the SDK will capture an environment snapshot of - your user's device including all console logs, server-side network requests - and bug reproduction steps compiling all these details in one organised dashboard - to help you debug and fix bugs faster. + Deliver the best user experience through a comprehensive platform that will + help you uncover, analyze and fix any app performance, quality or stability issues. homepage: https://github.com/Instabug/Instabug-Flutter#readme documentation: https://github.com/Instabug/Instabug-Flutter#readme @@ -19,7 +15,7 @@ dev_dependencies: build_runner: ^2.0.3 flutter_test: sdk: flutter - mockito: ^5.0.7 + mockito: ^5.0.10 flutter: plugin: @@ -32,4 +28,4 @@ flutter: environment: sdk: ">=2.12.0 <3.0.0" - flutter: ">=2.0.0 <3.0.0" + flutter: ">=1.17.0 <3.0.0" diff --git a/test/network_logger_test.dart b/test/network_logger_test.dart index 826d9a2c3..b7bb571f1 100644 --- a/test/network_logger_test.dart +++ b/test/network_logger_test.dart @@ -27,6 +27,8 @@ void main() { const String path = '/posts'; late InstabugCustomHttpClient instabugCustomHttpClient; + late MockHttpClientRequest mockRequest; + late MockHttpClientResponse mockResponse; setUpAll(() async { const MethodChannel('instabug_flutter') @@ -39,6 +41,14 @@ void main() { instabugCustomHttpClient = InstabugCustomHttpClient(); instabugCustomHttpClient.client = MockHttpClient(); instabugCustomHttpClient.logger = MockHttpClientLogger(); + + mockRequest = MockHttpClientRequest(); + mockResponse = MockHttpClientResponse(); + + expect(mockRequest, isInstanceOf()); + expect(mockResponse, isInstanceOf()); + + when(mockRequest.close()).thenAnswer((_) async => mockResponse); }); tearDown(() async { @@ -49,28 +59,26 @@ void main() { () async { when( (instabugCustomHttpClient.client as MockHttpClient).getUrl(any)) - .thenAnswer((_) async => MockHttpClientRequest()); + .thenAnswer((_) async => mockRequest); - final request = await instabugCustomHttpClient.getUrl(Uri.parse(url)); - final response = await request.close(); - expect(request, isInstanceOf()); - verify(instabugCustomHttpClient.logger.onRequest(request)).called(1); - verify(instabugCustomHttpClient.logger.onResponse(response, request)) - .called(1); + await instabugCustomHttpClient.getUrl(Uri.parse(url)); + + verify(instabugCustomHttpClient.logger.onRequest(mockRequest)); + verify( + instabugCustomHttpClient.logger.onResponse(mockResponse, mockRequest)); }); test('expect instabug custom http client GET to return request and log', () async { when((instabugCustomHttpClient.client as MockHttpClient) .get(any, any, any)) - .thenAnswer((_) async => MockHttpClientRequest()); + .thenAnswer((_) async => mockRequest); - final request = await instabugCustomHttpClient.get(url, port, path); - final response = await request.close(); - expect(request, isInstanceOf()); - verify(instabugCustomHttpClient.logger.onRequest(request)).called(1); - verify(instabugCustomHttpClient.logger.onResponse(response, request)) - .called(1); + await instabugCustomHttpClient.get(url, port, path); + + verify(instabugCustomHttpClient.logger.onRequest(mockRequest)); + verify( + instabugCustomHttpClient.logger.onResponse(mockResponse, mockRequest)); }); test( @@ -78,197 +86,182 @@ void main() { () async { when( (instabugCustomHttpClient.client as MockHttpClient).deleteUrl(any)) - .thenAnswer((_) async => MockHttpClientRequest()); + .thenAnswer((_) async => mockRequest); - final request = await instabugCustomHttpClient.deleteUrl(Uri.parse(url)); - final response = await request.close(); - expect(request, isInstanceOf()); - verify(instabugCustomHttpClient.logger.onRequest(request)).called(1); - verify(instabugCustomHttpClient.logger.onResponse(response, request)) - .called(1); + await instabugCustomHttpClient.deleteUrl(Uri.parse(url)); + + verify(instabugCustomHttpClient.logger.onRequest(mockRequest)); + verify( + instabugCustomHttpClient.logger.onResponse(mockResponse, mockRequest)); }); test('expect instabug custom http client DELETE to return request and log', () async { when((instabugCustomHttpClient.client as MockHttpClient) .delete(any, any, any)) - .thenAnswer((_) async => MockHttpClientRequest()); + .thenAnswer((_) async => mockRequest); - final request = await instabugCustomHttpClient.delete(url, port, path); - final response = await request.close(); - expect(request, isInstanceOf()); - verify(instabugCustomHttpClient.logger.onRequest(request)).called(1); - verify(instabugCustomHttpClient.logger.onResponse(response, request)) - .called(1); + await instabugCustomHttpClient.delete(url, port, path); + + verify(instabugCustomHttpClient.logger.onRequest(mockRequest)); + verify( + instabugCustomHttpClient.logger.onResponse(mockResponse, mockRequest)); }); test('expect instabug custom http client POST URL to return request and log', () async { when( (instabugCustomHttpClient.client as MockHttpClient).postUrl(any)) - .thenAnswer((_) async => MockHttpClientRequest()); + .thenAnswer((_) async => mockRequest); - final request = await instabugCustomHttpClient.postUrl(Uri.parse(url)); - final response = await request.close(); - expect(request, isInstanceOf()); - verify(instabugCustomHttpClient.logger.onRequest(request)).called(1); - verify(instabugCustomHttpClient.logger.onResponse(response, request)) - .called(1); + await instabugCustomHttpClient.postUrl(Uri.parse(url)); + + verify(instabugCustomHttpClient.logger.onRequest(mockRequest)); + verify( + instabugCustomHttpClient.logger.onResponse(mockResponse, mockRequest)); }); test('expect instabug custom http client POST to return request and log', () async { when((instabugCustomHttpClient.client as MockHttpClient) .post(any, any, any)) - .thenAnswer((_) async => MockHttpClientRequest()); + .thenAnswer((_) async => mockRequest); - final request = await instabugCustomHttpClient.post(url, port, path); - final response = await request.close(); - expect(request, isInstanceOf()); - verify(instabugCustomHttpClient.logger.onRequest(request)).called(1); - verify(instabugCustomHttpClient.logger.onResponse(response, request)) - .called(1); + await instabugCustomHttpClient.post(url, port, path); + + verify(instabugCustomHttpClient.logger.onRequest(mockRequest)); + verify( + instabugCustomHttpClient.logger.onResponse(mockResponse, mockRequest)); }); test('expect instabug custom http client HEAD URL to return request and log', () async { when( (instabugCustomHttpClient.client as MockHttpClient).headUrl(any)) - .thenAnswer((_) async => MockHttpClientRequest()); + .thenAnswer((_) async => mockRequest); - final request = await instabugCustomHttpClient.headUrl(Uri.parse(url)); - final response = await request.close(); - expect(request, isInstanceOf()); - verify(instabugCustomHttpClient.logger.onRequest(request)).called(1); - verify(instabugCustomHttpClient.logger.onResponse(response, request)) - .called(1); + await instabugCustomHttpClient.headUrl(Uri.parse(url)); + + verify(instabugCustomHttpClient.logger.onRequest(mockRequest)); + verify( + instabugCustomHttpClient.logger.onResponse(mockResponse, mockRequest)); }); test('expect instabug custom http client HEAD to return request and log', () async { when((instabugCustomHttpClient.client as MockHttpClient) .head(any, any, any)) - .thenAnswer((_) async => MockHttpClientRequest()); + .thenAnswer((_) async => mockRequest); - final request = await instabugCustomHttpClient.head(url, port, path); - final response = await request.close(); - expect(request, isInstanceOf()); - verify(instabugCustomHttpClient.logger.onRequest(request)).called(1); - verify(instabugCustomHttpClient.logger.onResponse(response, request)) - .called(1); + await instabugCustomHttpClient.head(url, port, path); + + verify(instabugCustomHttpClient.logger.onRequest(mockRequest)); + verify( + instabugCustomHttpClient.logger.onResponse(mockResponse, mockRequest)); }); test('expect instabug custom http client PATCH URL to return request and log', () async { when( (instabugCustomHttpClient.client as MockHttpClient).patchUrl(any)) - .thenAnswer((_) async => MockHttpClientRequest()); + .thenAnswer((_) async => mockRequest); - final request = await instabugCustomHttpClient.patchUrl(Uri.parse(url)); - final response = await request.close(); - expect(request, isInstanceOf()); - verify(instabugCustomHttpClient.logger.onRequest(request)).called(1); - verify(instabugCustomHttpClient.logger.onResponse(response, request)) - .called(1); + await instabugCustomHttpClient.patchUrl(Uri.parse(url)); + + verify(instabugCustomHttpClient.logger.onRequest(mockRequest)); + verify( + instabugCustomHttpClient.logger.onResponse(mockResponse, mockRequest)); }); test('expect instabug custom http client PATCH to return request and log', () async { when((instabugCustomHttpClient.client as MockHttpClient) .patch(any, any, any)) - .thenAnswer((_) async => MockHttpClientRequest()); + .thenAnswer((_) async => mockRequest); - final request = await instabugCustomHttpClient.patch(url, port, path); - final response = await request.close(); - expect(request, isInstanceOf()); - verify(instabugCustomHttpClient.logger.onRequest(request)).called(1); - verify(instabugCustomHttpClient.logger.onResponse(response, request)) - .called(1); + await instabugCustomHttpClient.patch(url, port, path); + + verify(instabugCustomHttpClient.logger.onRequest(mockRequest)); + verify( + instabugCustomHttpClient.logger.onResponse(mockResponse, mockRequest)); }); test('expect instabug custom http client OPEN URL to return request and log', () async { when((instabugCustomHttpClient.client as MockHttpClient) .openUrl(any, any)) - .thenAnswer((_) async => MockHttpClientRequest()); - - final request = - await instabugCustomHttpClient.openUrl('GET', Uri.parse(url)); - final response = await request.close(); - expect(request, isInstanceOf()); - verify(instabugCustomHttpClient.logger.onRequest(request)).called(1); - verify(instabugCustomHttpClient.logger.onResponse(response, request)) - .called(1); + .thenAnswer((_) async => mockRequest); + + await instabugCustomHttpClient.openUrl('GET', Uri.parse(url)); + + verify(instabugCustomHttpClient.logger.onRequest(mockRequest)); + verify( + instabugCustomHttpClient.logger.onResponse(mockResponse, mockRequest)); }); test('expect instabug custom http client OPEN to return request and log', () async { when((instabugCustomHttpClient.client as MockHttpClient) .open(any, any, any, any)) - .thenAnswer((_) async => MockHttpClientRequest()); + .thenAnswer((_) async => mockRequest); - final request = await instabugCustomHttpClient.open('GET', url, port, path); - final response = await request.close(); - expect(request, isInstanceOf()); - verify(instabugCustomHttpClient.logger.onRequest(request)).called(1); - verify(instabugCustomHttpClient.logger.onResponse(response, request)) - .called(1); + await instabugCustomHttpClient.open('GET', url, port, path); + + verify(instabugCustomHttpClient.logger.onRequest(mockRequest)); + verify( + instabugCustomHttpClient.logger.onResponse(mockResponse, mockRequest)); }); test('expect instabug custom http client PUT URL to return request and log', () async { when( (instabugCustomHttpClient.client as MockHttpClient).putUrl(any)) - .thenAnswer((_) async => MockHttpClientRequest()); + .thenAnswer((_) async => mockRequest); - final request = await instabugCustomHttpClient.putUrl(Uri.parse(url)); - final response = await request.close(); - expect(request, isInstanceOf()); - verify(instabugCustomHttpClient.logger.onRequest(request)).called(1); - verify(instabugCustomHttpClient.logger.onResponse(response, request)) - .called(1); + await instabugCustomHttpClient.putUrl(Uri.parse(url)); + + verify(instabugCustomHttpClient.logger.onRequest(mockRequest)); + verify( + instabugCustomHttpClient.logger.onResponse(mockResponse, mockRequest)); }); test('expect instabug custom http client PUT to return request and log', () async { when((instabugCustomHttpClient.client as MockHttpClient) .put(any, any, any)) - .thenAnswer((_) async => MockHttpClientRequest()); + .thenAnswer((_) async => mockRequest); - final request = await instabugCustomHttpClient.put(url, port, path); - final response = await request.close(); - expect(request, isInstanceOf()); - verify(instabugCustomHttpClient.logger.onRequest(request)).called(1); - verify(instabugCustomHttpClient.logger.onResponse(response, request)) - .called(1); + await instabugCustomHttpClient.put(url, port, path); + + verify(instabugCustomHttpClient.logger.onRequest(mockRequest)); + verify( + instabugCustomHttpClient.logger.onResponse(mockResponse, mockRequest)); }); test('expect instabug custom http client POST URL to return request and log', () async { when( (instabugCustomHttpClient.client as MockHttpClient).postUrl(any)) - .thenAnswer((_) async => MockHttpClientRequest()); + .thenAnswer((_) async => mockRequest); - final request = await instabugCustomHttpClient.postUrl(Uri.parse(url)); - final response = await request.close(); - expect(request, isInstanceOf()); - verify(instabugCustomHttpClient.logger.onRequest(request)).called(1); - verify(instabugCustomHttpClient.logger.onResponse(response, request)) - .called(1); + await instabugCustomHttpClient.postUrl(Uri.parse(url)); + + verify(instabugCustomHttpClient.logger.onRequest(mockRequest)); + verify( + instabugCustomHttpClient.logger.onResponse(mockResponse, mockRequest)); }); test('expect instabug custom http client POST to return request and log', () async { when((instabugCustomHttpClient.client as MockHttpClient) .post(any, any, any)) - .thenAnswer((_) async => MockHttpClientRequest()); + .thenAnswer((_) async => mockRequest); - final request = await instabugCustomHttpClient.post(url, port, path); - final response = await request.close(); - expect(request, isInstanceOf()); - verify(instabugCustomHttpClient.logger.onRequest(request)).called(1); - verify(instabugCustomHttpClient.logger.onResponse(response, request)) - .called(1); + await instabugCustomHttpClient.post(url, port, path); + + verify(instabugCustomHttpClient.logger.onRequest(mockRequest)); + verify( + instabugCustomHttpClient.logger.onResponse(mockResponse, mockRequest)); }); test('expect instabug custom http client to get client autoUncompress', @@ -411,7 +404,7 @@ void main() { test('Stress test on GET URL method', () async { when( (instabugCustomHttpClient.client as MockHttpClient).getUrl(any)) - .thenAnswer((_) async => MockHttpClientRequest()); + .thenAnswer((_) async => mockRequest); for (int i = 0; i < 10000; i++) { await instabugCustomHttpClient.getUrl(Uri.parse(url)); diff --git a/test/network_logger_test.mocks.dart b/test/network_logger_test.mocks.dart index 61d0f61c4..0a0ebc0a4 100644 --- a/test/network_logger_test.mocks.dart +++ b/test/network_logger_test.mocks.dart @@ -1,39 +1,50 @@ -// Mocks generated by Mockito 5.0.7 from annotations -// in instabug_flutter/test/network_logger_test.dart. +// Mocks generated by Mockito 5.0.10 from annotations +// in instabug_flutter/example/ios/.symlinks/plugins/instabug_flutter/test/network_logger_test.dart. // Do not manually edit this file. import 'dart:async' as _i4; -import 'dart:io' as _i3; +import 'dart:convert' as _i3; +import 'dart:io' as _i2; import 'package:instabug_flutter/models/network_data.dart' as _i6; import 'package:instabug_flutter/utils/http_client_logger.dart' as _i5; import 'package:mockito/mockito.dart' as _i1; +// ignore_for_file: avoid_redundant_argument_values // ignore_for_file: comment_references -// ignore_for_file: unnecessary_parenthesis - +// ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors +// ignore_for_file: unnecessary_parenthesis -// ignore_for_file: avoid_redundant_argument_values - -class _FakeDuration extends _i1.Fake implements Duration {} +class _FakeDuration extends _i1.Fake implements Duration { + @override + String toString() => super.toString(); +} -class _FakeHttpClientRequest extends _i1.Fake implements _i3.HttpClientRequest { +class _FakeHttpClientRequest extends _i1.Fake implements _i2.HttpClientRequest { } -class _FakeUri extends _i1.Fake implements Uri {} +class _FakeUri extends _i1.Fake implements Uri { + @override + String toString() => super.toString(); +} -class _FakeHttpHeaders extends _i1.Fake implements _i3.HttpHeaders {} +class _FakeHttpHeaders extends _i1.Fake implements _i2.HttpHeaders {} class _FakeHttpClientResponse extends _i1.Fake - implements _i3.HttpClientResponse {} + implements _i2.HttpClientResponse {} -class _FakeSocket extends _i1.Fake implements _i3.Socket {} +class _FakeEncoding extends _i1.Fake implements _i3.Encoding {} + +class _FakeSocket extends _i1.Fake implements _i2.Socket {} + +class _FakeStreamSubscription extends _i1.Fake + implements _i4.StreamSubscription {} /// A class which mocks [HttpClient]. /// /// See the documentation for Mockito's code generation for more information. -class MockHttpClient extends _i1.Mock implements _i3.HttpClient { +class MockHttpClient extends _i1.Mock implements _i2.HttpClient { MockHttpClient() { _i1.throwOnMissingStub(this); } @@ -81,109 +92,109 @@ class MockHttpClient extends _i1.Mock implements _i3.HttpClient { returnValueForMissingStub: null); @override set badCertificateCallback( - bool Function(_i3.X509Certificate, String, int)? callback) => + bool Function(_i2.X509Certificate, String, int)? callback) => super.noSuchMethod(Invocation.setter(#badCertificateCallback, callback), returnValueForMissingStub: null); @override - _i4.Future<_i3.HttpClientRequest> open( + _i4.Future<_i2.HttpClientRequest> open( String? method, String? host, int? port, String? path) => (super.noSuchMethod(Invocation.method(#open, [method, host, port, path]), returnValue: - Future<_i3.HttpClientRequest>.value(_FakeHttpClientRequest())) - as _i4.Future<_i3.HttpClientRequest>); + Future<_i2.HttpClientRequest>.value(_FakeHttpClientRequest())) + as _i4.Future<_i2.HttpClientRequest>); @override - _i4.Future<_i3.HttpClientRequest> openUrl(String? method, Uri? url) => + _i4.Future<_i2.HttpClientRequest> openUrl(String? method, Uri? url) => (super.noSuchMethod(Invocation.method(#openUrl, [method, url]), returnValue: - Future<_i3.HttpClientRequest>.value(_FakeHttpClientRequest())) - as _i4.Future<_i3.HttpClientRequest>); + Future<_i2.HttpClientRequest>.value(_FakeHttpClientRequest())) + as _i4.Future<_i2.HttpClientRequest>); @override - _i4.Future<_i3.HttpClientRequest> get( + _i4.Future<_i2.HttpClientRequest> get( String? host, int? port, String? path) => (super.noSuchMethod(Invocation.method(#get, [host, port, path]), returnValue: - Future<_i3.HttpClientRequest>.value(_FakeHttpClientRequest())) - as _i4.Future<_i3.HttpClientRequest>); + Future<_i2.HttpClientRequest>.value(_FakeHttpClientRequest())) + as _i4.Future<_i2.HttpClientRequest>); @override - _i4.Future<_i3.HttpClientRequest> getUrl(Uri? url) => + _i4.Future<_i2.HttpClientRequest> getUrl(Uri? url) => (super.noSuchMethod(Invocation.method(#getUrl, [url]), returnValue: - Future<_i3.HttpClientRequest>.value(_FakeHttpClientRequest())) - as _i4.Future<_i3.HttpClientRequest>); + Future<_i2.HttpClientRequest>.value(_FakeHttpClientRequest())) + as _i4.Future<_i2.HttpClientRequest>); @override - _i4.Future<_i3.HttpClientRequest> post( + _i4.Future<_i2.HttpClientRequest> post( String? host, int? port, String? path) => (super.noSuchMethod(Invocation.method(#post, [host, port, path]), returnValue: - Future<_i3.HttpClientRequest>.value(_FakeHttpClientRequest())) - as _i4.Future<_i3.HttpClientRequest>); + Future<_i2.HttpClientRequest>.value(_FakeHttpClientRequest())) + as _i4.Future<_i2.HttpClientRequest>); @override - _i4.Future<_i3.HttpClientRequest> postUrl(Uri? url) => + _i4.Future<_i2.HttpClientRequest> postUrl(Uri? url) => (super.noSuchMethod(Invocation.method(#postUrl, [url]), returnValue: - Future<_i3.HttpClientRequest>.value(_FakeHttpClientRequest())) - as _i4.Future<_i3.HttpClientRequest>); + Future<_i2.HttpClientRequest>.value(_FakeHttpClientRequest())) + as _i4.Future<_i2.HttpClientRequest>); @override - _i4.Future<_i3.HttpClientRequest> put( + _i4.Future<_i2.HttpClientRequest> put( String? host, int? port, String? path) => (super.noSuchMethod(Invocation.method(#put, [host, port, path]), returnValue: - Future<_i3.HttpClientRequest>.value(_FakeHttpClientRequest())) - as _i4.Future<_i3.HttpClientRequest>); + Future<_i2.HttpClientRequest>.value(_FakeHttpClientRequest())) + as _i4.Future<_i2.HttpClientRequest>); @override - _i4.Future<_i3.HttpClientRequest> putUrl(Uri? url) => + _i4.Future<_i2.HttpClientRequest> putUrl(Uri? url) => (super.noSuchMethod(Invocation.method(#putUrl, [url]), returnValue: - Future<_i3.HttpClientRequest>.value(_FakeHttpClientRequest())) - as _i4.Future<_i3.HttpClientRequest>); + Future<_i2.HttpClientRequest>.value(_FakeHttpClientRequest())) + as _i4.Future<_i2.HttpClientRequest>); @override - _i4.Future<_i3.HttpClientRequest> delete( + _i4.Future<_i2.HttpClientRequest> delete( String? host, int? port, String? path) => (super.noSuchMethod(Invocation.method(#delete, [host, port, path]), returnValue: - Future<_i3.HttpClientRequest>.value(_FakeHttpClientRequest())) - as _i4.Future<_i3.HttpClientRequest>); + Future<_i2.HttpClientRequest>.value(_FakeHttpClientRequest())) + as _i4.Future<_i2.HttpClientRequest>); @override - _i4.Future<_i3.HttpClientRequest> deleteUrl(Uri? url) => + _i4.Future<_i2.HttpClientRequest> deleteUrl(Uri? url) => (super.noSuchMethod(Invocation.method(#deleteUrl, [url]), returnValue: - Future<_i3.HttpClientRequest>.value(_FakeHttpClientRequest())) - as _i4.Future<_i3.HttpClientRequest>); + Future<_i2.HttpClientRequest>.value(_FakeHttpClientRequest())) + as _i4.Future<_i2.HttpClientRequest>); @override - _i4.Future<_i3.HttpClientRequest> patch( + _i4.Future<_i2.HttpClientRequest> patch( String? host, int? port, String? path) => (super.noSuchMethod(Invocation.method(#patch, [host, port, path]), returnValue: - Future<_i3.HttpClientRequest>.value(_FakeHttpClientRequest())) - as _i4.Future<_i3.HttpClientRequest>); + Future<_i2.HttpClientRequest>.value(_FakeHttpClientRequest())) + as _i4.Future<_i2.HttpClientRequest>); @override - _i4.Future<_i3.HttpClientRequest> patchUrl(Uri? url) => + _i4.Future<_i2.HttpClientRequest> patchUrl(Uri? url) => (super.noSuchMethod(Invocation.method(#patchUrl, [url]), returnValue: - Future<_i3.HttpClientRequest>.value(_FakeHttpClientRequest())) - as _i4.Future<_i3.HttpClientRequest>); + Future<_i2.HttpClientRequest>.value(_FakeHttpClientRequest())) + as _i4.Future<_i2.HttpClientRequest>); @override - _i4.Future<_i3.HttpClientRequest> head( + _i4.Future<_i2.HttpClientRequest> head( String? host, int? port, String? path) => (super.noSuchMethod(Invocation.method(#head, [host, port, path]), returnValue: - Future<_i3.HttpClientRequest>.value(_FakeHttpClientRequest())) - as _i4.Future<_i3.HttpClientRequest>); + Future<_i2.HttpClientRequest>.value(_FakeHttpClientRequest())) + as _i4.Future<_i2.HttpClientRequest>); @override - _i4.Future<_i3.HttpClientRequest> headUrl(Uri? url) => + _i4.Future<_i2.HttpClientRequest> headUrl(Uri? url) => (super.noSuchMethod(Invocation.method(#headUrl, [url]), returnValue: - Future<_i3.HttpClientRequest>.value(_FakeHttpClientRequest())) - as _i4.Future<_i3.HttpClientRequest>); + Future<_i2.HttpClientRequest>.value(_FakeHttpClientRequest())) + as _i4.Future<_i2.HttpClientRequest>); @override void addCredentials( - Uri? url, String? realm, _i3.HttpClientCredentials? credentials) => + Uri? url, String? realm, _i2.HttpClientCredentials? credentials) => super.noSuchMethod( Invocation.method(#addCredentials, [url, realm, credentials]), returnValueForMissingStub: null); @override void addProxyCredentials(String? host, int? port, String? realm, - _i3.HttpClientCredentials? credentials) => + _i2.HttpClientCredentials? credentials) => super.noSuchMethod( Invocation.method( #addProxyCredentials, [host, port, realm, credentials]), @@ -207,13 +218,13 @@ class MockHttpClientLogger extends _i1.Mock implements _i5.HttpClientLogger { (super.noSuchMethod(Invocation.getter(#requests), returnValue: {}) as Map); @override - void onRequest(_i3.HttpClientRequest? request, {dynamic requestBody}) => + void onRequest(_i2.HttpClientRequest? request, {dynamic requestBody}) => super.noSuchMethod( Invocation.method(#onRequest, [request], {#requestBody: requestBody}), returnValueForMissingStub: null); @override void onResponse( - _i3.HttpClientResponse? response, _i3.HttpClientRequest? request, + _i2.HttpClientResponse? response, _i2.HttpClientRequest? request, {dynamic responseBody}) => super.noSuchMethod( Invocation.method( @@ -224,7 +235,7 @@ class MockHttpClientLogger extends _i1.Mock implements _i5.HttpClientLogger { /// A class which mocks [HttpClientRequest]. /// /// See the documentation for Mockito's code generation for more information. -class MockHttpClientRequest extends _i1.Mock implements _i3.HttpClientRequest { +class MockHttpClientRequest extends _i1.Mock implements _i2.HttpClientRequest { MockHttpClientRequest() { _i1.throwOnMissingStub(this); } @@ -278,32 +289,75 @@ class MockHttpClientRequest extends _i1.Mock implements _i3.HttpClientRequest { (super.noSuchMethod(Invocation.getter(#uri), returnValue: _FakeUri()) as Uri); @override - _i3.HttpHeaders get headers => + _i2.HttpHeaders get headers => (super.noSuchMethod(Invocation.getter(#headers), - returnValue: _FakeHttpHeaders()) as _i3.HttpHeaders); + returnValue: _FakeHttpHeaders()) as _i2.HttpHeaders); @override - List<_i3.Cookie> get cookies => + List<_i2.Cookie> get cookies => (super.noSuchMethod(Invocation.getter(#cookies), - returnValue: <_i3.Cookie>[]) as List<_i3.Cookie>); + returnValue: <_i2.Cookie>[]) as List<_i2.Cookie>); @override - _i4.Future<_i3.HttpClientResponse> get done => (super.noSuchMethod( + _i4.Future<_i2.HttpClientResponse> get done => (super.noSuchMethod( Invocation.getter(#done), returnValue: - Future<_i3.HttpClientResponse>.value(_FakeHttpClientResponse())) - as _i4.Future<_i3.HttpClientResponse>); + Future<_i2.HttpClientResponse>.value(_FakeHttpClientResponse())) + as _i4.Future<_i2.HttpClientResponse>); @override - _i4.Future<_i3.HttpClientResponse> close() async => MockHttpClientResponse(); + _i3.Encoding get encoding => (super.noSuchMethod(Invocation.getter(#encoding), + returnValue: _FakeEncoding()) as _i3.Encoding); + @override + set encoding(_i3.Encoding? _encoding) => + super.noSuchMethod(Invocation.setter(#encoding, _encoding), + returnValueForMissingStub: null); + @override + _i4.Future<_i2.HttpClientResponse> close() => (super.noSuchMethod( + Invocation.method(#close, []), + returnValue: + Future<_i2.HttpClientResponse>.value(_FakeHttpClientResponse())) + as _i4.Future<_i2.HttpClientResponse>); @override void abort([Object? exception, StackTrace? stackTrace]) => super.noSuchMethod(Invocation.method(#abort, [exception, stackTrace]), returnValueForMissingStub: null); + @override + void add(List? data) => + super.noSuchMethod(Invocation.method(#add, [data]), + returnValueForMissingStub: null); + @override + void write(Object? object) => + super.noSuchMethod(Invocation.method(#write, [object]), + returnValueForMissingStub: null); + @override + void writeAll(Iterable? objects, [String? separator = r'']) => + super.noSuchMethod(Invocation.method(#writeAll, [objects, separator]), + returnValueForMissingStub: null); + @override + void writeln([Object? object = r'']) => + super.noSuchMethod(Invocation.method(#writeln, [object]), + returnValueForMissingStub: null); + @override + void writeCharCode(int? charCode) => + super.noSuchMethod(Invocation.method(#writeCharCode, [charCode]), + returnValueForMissingStub: null); + @override + void addError(Object? error, [StackTrace? stackTrace]) => + super.noSuchMethod(Invocation.method(#addError, [error, stackTrace]), + returnValueForMissingStub: null); + @override + _i4.Future addStream(_i4.Stream>? stream) => + (super.noSuchMethod(Invocation.method(#addStream, [stream]), + returnValue: Future.value()) as _i4.Future); + @override + _i4.Future flush() => + (super.noSuchMethod(Invocation.method(#flush, []), + returnValue: Future.value()) as _i4.Future); } /// A class which mocks [HttpClientResponse]. /// /// See the documentation for Mockito's code generation for more information. class MockHttpClientResponse extends _i1.Mock - implements _i3.HttpClientResponse { + implements _i2.HttpClientResponse { MockHttpClientResponse() { _i1.throwOnMissingStub(this); } @@ -321,10 +375,10 @@ class MockHttpClientResponse extends _i1.Mock (super.noSuchMethod(Invocation.getter(#contentLength), returnValue: 0) as int); @override - _i3.HttpClientResponseCompressionState get compressionState => + _i2.HttpClientResponseCompressionState get compressionState => (super.noSuchMethod(Invocation.getter(#compressionState), - returnValue: _i3.HttpClientResponseCompressionState.notCompressed) - as _i3.HttpClientResponseCompressionState); + returnValue: _i2.HttpClientResponseCompressionState.notCompressed) + as _i2.HttpClientResponseCompressionState); @override bool get persistentConnection => (super.noSuchMethod(Invocation.getter(#persistentConnection), @@ -334,37 +388,215 @@ class MockHttpClientResponse extends _i1.Mock (super.noSuchMethod(Invocation.getter(#isRedirect), returnValue: false) as bool); @override - List<_i3.RedirectInfo> get redirects => + List<_i2.RedirectInfo> get redirects => (super.noSuchMethod(Invocation.getter(#redirects), - returnValue: <_i3.RedirectInfo>[]) as List<_i3.RedirectInfo>); + returnValue: <_i2.RedirectInfo>[]) as List<_i2.RedirectInfo>); @override - _i3.HttpHeaders get headers => + _i2.HttpHeaders get headers => (super.noSuchMethod(Invocation.getter(#headers), - returnValue: _FakeHttpHeaders()) as _i3.HttpHeaders); + returnValue: _FakeHttpHeaders()) as _i2.HttpHeaders); @override - List<_i3.Cookie> get cookies => + List<_i2.Cookie> get cookies => (super.noSuchMethod(Invocation.getter(#cookies), - returnValue: <_i3.Cookie>[]) as List<_i3.Cookie>); + returnValue: <_i2.Cookie>[]) as List<_i2.Cookie>); + @override + bool get isBroadcast => + (super.noSuchMethod(Invocation.getter(#isBroadcast), returnValue: false) + as bool); @override - _i4.Future<_i3.HttpClientResponse> redirect( + _i4.Future get length => (super.noSuchMethod(Invocation.getter(#length), + returnValue: Future.value(0)) as _i4.Future); + @override + _i4.Future get isEmpty => + (super.noSuchMethod(Invocation.getter(#isEmpty), + returnValue: Future.value(false)) as _i4.Future); + @override + _i4.Future> get first => (super.noSuchMethod( + Invocation.getter(#first), + returnValue: Future>.value([])) as _i4.Future>); + @override + _i4.Future> get last => (super.noSuchMethod( + Invocation.getter(#last), + returnValue: Future>.value([])) as _i4.Future>); + @override + _i4.Future> get single => (super.noSuchMethod( + Invocation.getter(#single), + returnValue: Future>.value([])) as _i4.Future>); + @override + _i4.Future<_i2.HttpClientResponse> redirect( [String? method, Uri? url, bool? followLoops]) => (super.noSuchMethod( Invocation.method(#redirect, [method, url, followLoops]), - returnValue: Future<_i3.HttpClientResponse>.value( + returnValue: Future<_i2.HttpClientResponse>.value( _FakeHttpClientResponse())) - as _i4.Future<_i3.HttpClientResponse>); + as _i4.Future<_i2.HttpClientResponse>); @override - _i4.Future<_i3.Socket> detachSocket() => + _i4.Future<_i2.Socket> detachSocket() => (super.noSuchMethod(Invocation.method(#detachSocket, []), - returnValue: Future<_i3.Socket>.value(_FakeSocket())) - as _i4.Future<_i3.Socket>); + returnValue: Future<_i2.Socket>.value(_FakeSocket())) + as _i4.Future<_i2.Socket>); + @override + _i4.Stream> asBroadcastStream( + {void Function(_i4.StreamSubscription>)? onListen, + void Function(_i4.StreamSubscription>)? onCancel}) => + (super.noSuchMethod( + Invocation.method(#asBroadcastStream, [], + {#onListen: onListen, #onCancel: onCancel}), + returnValue: Stream>.empty()) as _i4.Stream>); + @override + _i4.StreamSubscription> listen(void Function(List)? onData, + {Function? onError, void Function()? onDone, bool? cancelOnError}) => + (super.noSuchMethod( + Invocation.method(#listen, [ + onData + ], { + #onError: onError, + #onDone: onDone, + #cancelOnError: cancelOnError + }), + returnValue: _FakeStreamSubscription>()) + as _i4.StreamSubscription>); + @override + _i4.Stream> where(bool Function(List)? test) => + (super.noSuchMethod(Invocation.method(#where, [test]), + returnValue: Stream>.empty()) as _i4.Stream>); + @override + _i4.Stream map(S Function(List)? convert) => + (super.noSuchMethod(Invocation.method(#map, [convert]), + returnValue: Stream.empty()) as _i4.Stream); + @override + _i4.Stream asyncMap(_i4.FutureOr? Function(List)? convert) => + (super.noSuchMethod(Invocation.method(#asyncMap, [convert]), + returnValue: Stream.empty()) as _i4.Stream); + @override + _i4.Stream asyncExpand(_i4.Stream? Function(List)? convert) => + (super.noSuchMethod(Invocation.method(#asyncExpand, [convert]), + returnValue: Stream.empty()) as _i4.Stream); + @override + _i4.Stream> handleError(Function? onError, + {bool Function(dynamic)? test}) => + (super.noSuchMethod( + Invocation.method(#handleError, [onError], {#test: test}), + returnValue: Stream>.empty()) as _i4.Stream>); + @override + _i4.Stream expand(Iterable Function(List)? convert) => + (super.noSuchMethod(Invocation.method(#expand, [convert]), + returnValue: Stream.empty()) as _i4.Stream); + @override + _i4.Future pipe(_i4.StreamConsumer>? streamConsumer) => + (super.noSuchMethod(Invocation.method(#pipe, [streamConsumer]), + returnValue: Future.value()) as _i4.Future); + @override + _i4.Stream transform( + _i4.StreamTransformer, S>? streamTransformer) => + (super.noSuchMethod(Invocation.method(#transform, [streamTransformer]), + returnValue: Stream.empty()) as _i4.Stream); + @override + _i4.Future> reduce( + List Function(List, List)? combine) => + (super.noSuchMethod(Invocation.method(#reduce, [combine]), + returnValue: Future>.value([])) + as _i4.Future>); + @override + _i4.Future fold(S? initialValue, S Function(S, List)? combine) => + (super.noSuchMethod(Invocation.method(#fold, [initialValue, combine]), + returnValue: Future.value(null)) as _i4.Future); + @override + _i4.Future join([String? separator = r'']) => + (super.noSuchMethod(Invocation.method(#join, [separator]), + returnValue: Future.value('')) as _i4.Future); + @override + _i4.Future contains(Object? needle) => + (super.noSuchMethod(Invocation.method(#contains, [needle]), + returnValue: Future.value(false)) as _i4.Future); + @override + _i4.Future forEach(void Function(List)? action) => + (super.noSuchMethod(Invocation.method(#forEach, [action]), + returnValue: Future.value()) as _i4.Future); + @override + _i4.Future every(bool Function(List)? test) => + (super.noSuchMethod(Invocation.method(#every, [test]), + returnValue: Future.value(false)) as _i4.Future); + @override + _i4.Future any(bool Function(List)? test) => + (super.noSuchMethod(Invocation.method(#any, [test]), + returnValue: Future.value(false)) as _i4.Future); + @override + _i4.Stream cast() => (super.noSuchMethod(Invocation.method(#cast, []), + returnValue: Stream.empty()) as _i4.Stream); + @override + _i4.Future>> toList() => + (super.noSuchMethod(Invocation.method(#toList, []), + returnValue: Future>>.value(>[])) + as _i4.Future>>); + @override + _i4.Future>> toSet() => + (super.noSuchMethod(Invocation.method(#toSet, []), + returnValue: Future>>.value(>{})) + as _i4.Future>>); + @override + _i4.Future drain([E? futureValue]) => + (super.noSuchMethod(Invocation.method(#drain, [futureValue]), + returnValue: Future.value(null)) as _i4.Future); + @override + _i4.Stream> take(int? count) => + (super.noSuchMethod(Invocation.method(#take, [count]), + returnValue: Stream>.empty()) as _i4.Stream>); + @override + _i4.Stream> takeWhile(bool Function(List)? test) => + (super.noSuchMethod(Invocation.method(#takeWhile, [test]), + returnValue: Stream>.empty()) as _i4.Stream>); + @override + _i4.Stream> skip(int? count) => + (super.noSuchMethod(Invocation.method(#skip, [count]), + returnValue: Stream>.empty()) as _i4.Stream>); + @override + _i4.Stream> skipWhile(bool Function(List)? test) => + (super.noSuchMethod(Invocation.method(#skipWhile, [test]), + returnValue: Stream>.empty()) as _i4.Stream>); + @override + _i4.Stream> distinct( + [bool Function(List, List)? equals]) => + (super.noSuchMethod(Invocation.method(#distinct, [equals]), + returnValue: Stream>.empty()) as _i4.Stream>); + @override + _i4.Future> firstWhere(bool Function(List)? test, + {List Function()? orElse}) => + (super.noSuchMethod( + Invocation.method(#firstWhere, [test], {#orElse: orElse}), + returnValue: Future>.value([])) + as _i4.Future>); + @override + _i4.Future> lastWhere(bool Function(List)? test, + {List Function()? orElse}) => + (super.noSuchMethod( + Invocation.method(#lastWhere, [test], {#orElse: orElse}), + returnValue: Future>.value([])) + as _i4.Future>); + @override + _i4.Future> singleWhere(bool Function(List)? test, + {List Function()? orElse}) => + (super.noSuchMethod( + Invocation.method(#singleWhere, [test], {#orElse: orElse}), + returnValue: Future>.value([])) + as _i4.Future>); + @override + _i4.Future> elementAt(int? index) => (super.noSuchMethod( + Invocation.method(#elementAt, [index]), + returnValue: Future>.value([])) as _i4.Future>); + @override + _i4.Stream> timeout(Duration? timeLimit, + {void Function(_i4.EventSink>)? onTimeout}) => + (super.noSuchMethod( + Invocation.method(#timeout, [timeLimit], {#onTimeout: onTimeout}), + returnValue: Stream>.empty()) as _i4.Stream>); } /// A class which mocks [HttpClientCredentials]. /// /// See the documentation for Mockito's code generation for more information. class MockHttpClientCredentials extends _i1.Mock - implements _i3.HttpClientCredentials { + implements _i2.HttpClientCredentials { MockHttpClientCredentials() { _i1.throwOnMissingStub(this); }