From 6a6cf1bdf0da68ec2c27f25d67150bc7d3e8692e Mon Sep 17 00:00:00 2001 From: Volodymyr Date: Tue, 21 Apr 2026 14:17:01 +0300 Subject: [PATCH 1/2] feat(package_info_plus): Lower requirements to Dart 3.10 and Flutter --- packages/package_info_plus/package_info_plus/README.md | 4 ++-- .../example/ios/Flutter/AppFrameworkInfo.plist | 2 +- .../example/ios/Runner.xcodeproj/project.pbxproj | 6 +++--- .../Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme | 3 +++ .../package_info_plus/example/pubspec.yaml | 2 +- packages/package_info_plus/package_info_plus/pubspec.yaml | 6 +++--- .../package_info_plus_platform_interface/pubspec.yaml | 4 ++-- 7 files changed, 15 insertions(+), 12 deletions(-) diff --git a/packages/package_info_plus/package_info_plus/README.md b/packages/package_info_plus/package_info_plus/README.md index d1ada60f5d..4aecbed5c8 100644 --- a/packages/package_info_plus/package_info_plus/README.md +++ b/packages/package_info_plus/package_info_plus/README.md @@ -16,8 +16,8 @@ This Flutter plugin provides an API for querying information about an applicatio ## Requirements -- Flutter >=3.41.0 -- Dart >=3.11.0 <4.0.0 +- Flutter >=3.38.1 +- Dart >=3.10.0 <4.0.0 - iOS >=13.0 - macOS >=10.15 - Java 17 diff --git a/packages/package_info_plus/package_info_plus/example/ios/Flutter/AppFrameworkInfo.plist b/packages/package_info_plus/package_info_plus/example/ios/Flutter/AppFrameworkInfo.plist index 7c56964006..1dc6cf7652 100644 --- a/packages/package_info_plus/package_info_plus/example/ios/Flutter/AppFrameworkInfo.plist +++ b/packages/package_info_plus/package_info_plus/example/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 12.0 + 13.0 diff --git a/packages/package_info_plus/package_info_plus/example/ios/Runner.xcodeproj/project.pbxproj b/packages/package_info_plus/package_info_plus/example/ios/Runner.xcodeproj/project.pbxproj index 2ceb58bd97..73b8190994 100644 --- a/packages/package_info_plus/package_info_plus/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/package_info_plus/package_info_plus/example/ios/Runner.xcodeproj/project.pbxproj @@ -452,7 +452,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -579,7 +579,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -628,7 +628,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; diff --git a/packages/package_info_plus/package_info_plus/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/package_info_plus/package_info_plus/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 8e3ca5dfe1..e3773d42e2 100644 --- a/packages/package_info_plus/package_info_plus/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/packages/package_info_plus/package_info_plus/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -26,6 +26,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit" shouldUseLaunchSchemeArgsEnv = "YES"> diff --git a/packages/package_info_plus/package_info_plus/example/pubspec.yaml b/packages/package_info_plus/package_info_plus/example/pubspec.yaml index 080a51e953..926ddeacc7 100644 --- a/packages/package_info_plus/package_info_plus/example/pubspec.yaml +++ b/packages/package_info_plus/package_info_plus/example/pubspec.yaml @@ -4,7 +4,7 @@ version: 1.2.3+4 publish_to: "none" environment: - sdk: ">=3.3.0 <4.0.0" + sdk: ">=3.10.0 <4.0.0" dependencies: clock: ^1.1.1 diff --git a/packages/package_info_plus/package_info_plus/pubspec.yaml b/packages/package_info_plus/package_info_plus/pubspec.yaml index e5d48459bf..d061b95c54 100644 --- a/packages/package_info_plus/package_info_plus/pubspec.yaml +++ b/packages/package_info_plus/package_info_plus/pubspec.yaml @@ -39,7 +39,7 @@ dependencies: package_info_plus_platform_interface: ^4.0.0 path: ^1.9.1 web: ^1.1.1 - win32: ^6.0.0 + win32: ^6.0.1 dev_dependencies: flutter_lints: ^6.0.0 @@ -47,5 +47,5 @@ dev_dependencies: sdk: flutter environment: - sdk: ">=3.11.0 <4.0.0" - flutter: ">=3.41.0" + sdk: ">=3.10.0 <4.0.0" + flutter: ">=3.38.1" diff --git a/packages/package_info_plus/package_info_plus_platform_interface/pubspec.yaml b/packages/package_info_plus/package_info_plus_platform_interface/pubspec.yaml index 17bcd3a86a..86809e1367 100644 --- a/packages/package_info_plus/package_info_plus_platform_interface/pubspec.yaml +++ b/packages/package_info_plus/package_info_plus_platform_interface/pubspec.yaml @@ -17,5 +17,5 @@ dev_dependencies: flutter_lints: ^6.0.0 environment: - sdk: ">=3.11.0 <4.0.0" - flutter: ">=3.41.0" + sdk: ">=3.10.0 <4.0.0" + flutter: ">=3.38.1" From 7c8c6f7c7f335cc1bf8e9074dc3ff4bd0dc10065 Mon Sep 17 00:00:00 2001 From: Volodymyr Date: Tue, 21 Apr 2026 16:38:44 +0300 Subject: [PATCH 2/2] test(package_info_plus): Fix formatting in tests --- .../package_info_plus_test.dart | 13 +- .../package_info_plus_web_test.dart | 434 +++++++++--------- .../package_info_plus_web_test.mocks.dart | 381 ++++++--------- 3 files changed, 373 insertions(+), 455 deletions(-) diff --git a/packages/package_info_plus/package_info_plus/example/integration_test/package_info_plus_test.dart b/packages/package_info_plus/package_info_plus/example/integration_test/package_info_plus_test.dart index e7c789db65..0b1212382b 100644 --- a/packages/package_info_plus/package_info_plus/example/integration_test/package_info_plus_test.dart +++ b/packages/package_info_plus/package_info_plus/example/integration_test/package_info_plus_test.dart @@ -172,10 +172,7 @@ void main() { } else { final expectedInstallTimeIso = testStartTime.toIso8601String(); final installTimeRegex = RegExp( - expectedInstallTimeIso.replaceAll( - RegExp(r'\d:\d\d\..+$'), - r'.+$', - ), + expectedInstallTimeIso.replaceAll(RegExp(r'\d:\d\d\..+$'), r'.+$'), ); if (Platform.isAndroid) { @@ -200,7 +197,9 @@ void main() { expect(find.text('Package Info Plus Example'), findsOneWidget); expect(find.text('4'), findsOneWidget); expect( - find.text('io.flutter.plugins.packageInfoExample'), findsOneWidget); + find.text('io.flutter.plugins.packageInfoExample'), + findsOneWidget, + ); expect(find.text('1.2.3'), findsOneWidget); expect(find.text('Not set'), findsOneWidget); expect(find.text('com.apple.simulator'), findsOneWidget); @@ -209,7 +208,9 @@ void main() { expect(find.text('Package Info Plus Example'), findsOneWidget); expect(find.text('4'), findsOneWidget); expect( - find.text('io.flutter.plugins.packageInfoExample'), findsOneWidget); + find.text('io.flutter.plugins.packageInfoExample'), + findsOneWidget, + ); expect(find.text('1.2.3'), findsOneWidget); expect(find.text('Not set'), findsOneWidget); expect(find.text('not available'), findsOneWidget); diff --git a/packages/package_info_plus/package_info_plus/example/integration_test/package_info_plus_web_test.dart b/packages/package_info_plus/package_info_plus/example/integration_test/package_info_plus_web_test.dart index e5f8c6eb23..1ba5fa7b48 100644 --- a/packages/package_info_plus/package_info_plus/example/integration_test/package_info_plus_web_test.dart +++ b/packages/package_info_plus/package_info_plus/example/integration_test/package_info_plus_web_test.dart @@ -45,199 +45,196 @@ void main() { late MockClient client; late MockAssetManager assetManagerMock; - group( - 'Package Info Web', - () { - setUp(() { - client = MockClient(); - plugin = PackageInfoPlusWebPlugin(client); - }); + group('Package Info Web', () { + setUp(() { + client = MockClient(); + plugin = PackageInfoPlusWebPlugin(client); + }); - testWidgets( - 'Get correct values when response status is 200', - (tester) async { - when(client.get(any)).thenAnswer( - (_) => Future.value( - http.Response(jsonEncode(VERSION_JSON), 200), - ), - ); + testWidgets('Get correct values when response status is 200', ( + tester, + ) async { + when(client.get(any)).thenAnswer( + (_) => Future.value(http.Response(jsonEncode(VERSION_JSON), 200)), + ); - final versionMap = await plugin.getAll(); + final versionMap = await plugin.getAll(); - expect(versionMap.appName, VERSION_JSON['app_name']); - expect(versionMap.version, VERSION_JSON['version']); - expect(versionMap.buildNumber, VERSION_JSON['build_number']); - expect(versionMap.packageName, VERSION_JSON['package_name']); - expect(versionMap.buildSignature, VERSION_JSON['build_signature']); - }, - ); + expect(versionMap.appName, VERSION_JSON['app_name']); + expect(versionMap.version, VERSION_JSON['version']); + expect(versionMap.buildNumber, VERSION_JSON['build_number']); + expect(versionMap.packageName, VERSION_JSON['package_name']); + expect(versionMap.buildSignature, VERSION_JSON['build_signature']); + }); - testWidgets( - 'Get empty values when response status is not 200', - (tester) async { - when(client.get(any)).thenAnswer( - (_) => Future.value( - http.Response('', 404), - ), - ); + testWidgets('Get empty values when response status is not 200', ( + tester, + ) async { + when( + client.get(any), + ).thenAnswer((_) => Future.value(http.Response('', 404))); - final versionMap = await plugin.getAll(); + final versionMap = await plugin.getAll(); - expect(versionMap.appName, isEmpty); - expect(versionMap.buildNumber, isEmpty); - expect(versionMap.packageName, isEmpty); - expect(versionMap.version, isEmpty); - expect(versionMap.buildSignature, isEmpty); - }, - ); + expect(versionMap.appName, isEmpty); + expect(versionMap.buildNumber, isEmpty); + expect(versionMap.packageName, isEmpty); + expect(versionMap.version, isEmpty); + expect(versionMap.buildSignature, isEmpty); + }); - testWidgets( - 'Get correct values when using a custom base URL', - (tester) async { - const String baseUrl = 'https://www.example.com/'; - final DateTime now = DateTime.now(); - final Clock fakeClock = Clock(() => now); - - await withClock(fakeClock, () async { - final int cache = now.millisecondsSinceEpoch; - - when(client.get( - Uri.parse('${baseUrl}version.json?cachebuster=$cache'), - )).thenAnswer( - (_) => Future.value( - http.Response(jsonEncode(VERSION_JSON), 200), - ), - ); - - final versionMap = await plugin.getAll(baseUrl: baseUrl); - - expect(versionMap.appName, VERSION_JSON['app_name']); - expect(versionMap.version, VERSION_JSON['version']); - expect(versionMap.buildNumber, VERSION_JSON['build_number']); - expect(versionMap.packageName, VERSION_JSON['package_name']); - expect(versionMap.buildSignature, VERSION_JSON['build_signature']); - }); - }, - ); + testWidgets('Get correct values when using a custom base URL', ( + tester, + ) async { + const String baseUrl = 'https://www.example.com/'; + final DateTime now = DateTime.now(); + final Clock fakeClock = Clock(() => now); - testWidgets( - 'Get correct versionJsonUrl for http and https', - (tester) async { - expect( - plugin.versionJsonUrl('https://example.com/#/my-page', 1), - Uri.parse('https://example.com/version.json?cachebuster=1'), - ); - expect( - plugin.versionJsonUrl('https://example.com/a/b/c/#/my-page', 1), - Uri.parse('https://example.com/a/b/c/version.json?cachebuster=1'), - ); - expect( - plugin.versionJsonUrl('https://example.com/a/b/c/#/my-page', 1), - Uri.parse('https://example.com/a/b/c/version.json?cachebuster=1'), - ); - expect( - plugin.versionJsonUrl( - 'https://example.com/?hello_world=true#/my-page', 1), - Uri.parse('https://example.com/version.json?cachebuster=1'), - ); - expect( - plugin.versionJsonUrl( - 'https://example.com/a/b/c/?hello_world=true#/my-page', 1), - Uri.parse('https://example.com/a/b/c/version.json?cachebuster=1'), - ); - expect( - // 'c' here is to be considered as a page, not a folder - plugin.versionJsonUrl( - 'https://example.com/a/b/c?hello_world=true#/my-page', 1), - Uri.parse('https://example.com/a/b/version.json?cachebuster=1'), - ); - }, + await withClock(fakeClock, () async { + final int cache = now.millisecondsSinceEpoch; + + when( + client.get(Uri.parse('${baseUrl}version.json?cachebuster=$cache')), + ).thenAnswer( + (_) => Future.value(http.Response(jsonEncode(VERSION_JSON), 200)), + ); + + final versionMap = await plugin.getAll(baseUrl: baseUrl); + + expect(versionMap.appName, VERSION_JSON['app_name']); + expect(versionMap.version, VERSION_JSON['version']); + expect(versionMap.buildNumber, VERSION_JSON['build_number']); + expect(versionMap.packageName, VERSION_JSON['package_name']); + expect(versionMap.buildSignature, VERSION_JSON['build_signature']); + }); + }); + + testWidgets('Get correct versionJsonUrl for http and https', ( + tester, + ) async { + expect( + plugin.versionJsonUrl('https://example.com/#/my-page', 1), + Uri.parse('https://example.com/version.json?cachebuster=1'), + ); + expect( + plugin.versionJsonUrl('https://example.com/a/b/c/#/my-page', 1), + Uri.parse('https://example.com/a/b/c/version.json?cachebuster=1'), + ); + expect( + plugin.versionJsonUrl('https://example.com/a/b/c/#/my-page', 1), + Uri.parse('https://example.com/a/b/c/version.json?cachebuster=1'), + ); + expect( + plugin.versionJsonUrl( + 'https://example.com/?hello_world=true#/my-page', + 1, + ), + Uri.parse('https://example.com/version.json?cachebuster=1'), + ); + expect( + plugin.versionJsonUrl( + 'https://example.com/a/b/c/?hello_world=true#/my-page', + 1, + ), + Uri.parse('https://example.com/a/b/c/version.json?cachebuster=1'), ); + expect( + // 'c' here is to be considered as a page, not a folder + plugin.versionJsonUrl( + 'https://example.com/a/b/c?hello_world=true#/my-page', + 1, + ), + Uri.parse('https://example.com/a/b/version.json?cachebuster=1'), + ); + }); - testWidgets( - 'Get correct versionJsonUrl for urls to html files', - (tester) async { - expect( - plugin.versionJsonUrl('https://example.com', 1), - Uri.parse('https://example.com/version.json?cachebuster=1'), - ); - expect( - plugin.versionJsonUrl('https://example.com/', 1), - Uri.parse('https://example.com/version.json?cachebuster=1'), - ); - expect( - plugin.versionJsonUrl('https://example.com/index.html', 1), - Uri.parse('https://example.com/version.json?cachebuster=1'), - ); - expect( - plugin.versionJsonUrl('https://example.com/index.html#/my-page', 1), - Uri.parse('https://example.com/version.json?cachebuster=1'), - ); - expect( - plugin.versionJsonUrl( - 'https://example.com/index.html?hello_world=true/#/my-page', 1), - Uri.parse('https://example.com/version.json?cachebuster=1'), - ); - expect( - plugin.versionJsonUrl('https://example.com/a/b/c/wrapper.html', 1), - Uri.parse('https://example.com/a/b/c/version.json?cachebuster=1'), - ); - expect( - plugin.versionJsonUrl( - 'https://example.com/my-special-file.html', 1), - Uri.parse('https://example.com/version.json?cachebuster=1'), - ); - expect( - plugin.versionJsonUrl( - 'https://example.com/a/b/c/my-special-file.html', 1), - Uri.parse('https://example.com/a/b/c/version.json?cachebuster=1'), - ); - }, + testWidgets('Get correct versionJsonUrl for urls to html files', ( + tester, + ) async { + expect( + plugin.versionJsonUrl('https://example.com', 1), + Uri.parse('https://example.com/version.json?cachebuster=1'), + ); + expect( + plugin.versionJsonUrl('https://example.com/', 1), + Uri.parse('https://example.com/version.json?cachebuster=1'), + ); + expect( + plugin.versionJsonUrl('https://example.com/index.html', 1), + Uri.parse('https://example.com/version.json?cachebuster=1'), ); + expect( + plugin.versionJsonUrl('https://example.com/index.html#/my-page', 1), + Uri.parse('https://example.com/version.json?cachebuster=1'), + ); + expect( + plugin.versionJsonUrl( + 'https://example.com/index.html?hello_world=true/#/my-page', + 1, + ), + Uri.parse('https://example.com/version.json?cachebuster=1'), + ); + expect( + plugin.versionJsonUrl('https://example.com/a/b/c/wrapper.html', 1), + Uri.parse('https://example.com/a/b/c/version.json?cachebuster=1'), + ); + expect( + plugin.versionJsonUrl('https://example.com/my-special-file.html', 1), + Uri.parse('https://example.com/version.json?cachebuster=1'), + ); + expect( + plugin.versionJsonUrl( + 'https://example.com/a/b/c/my-special-file.html', + 1, + ), + Uri.parse('https://example.com/a/b/c/version.json?cachebuster=1'), + ); + }); - testWidgets('Get correct versionJsonUrl for chrome-extension', - (tester) async { - expect( - plugin.versionJsonUrl('chrome-extension://abcdefgh', 1), - Uri.parse('chrome-extension://abcdefgh/version.json?cachebuster=1'), - ); - expect( - plugin.versionJsonUrl('chrome-extension://abcdefgh/a/b/c', 1), - Uri.parse( - 'chrome-extension://abcdefgh/a/b/c/version.json?cachebuster=1'), - ); - expect( - plugin.versionJsonUrl('chrome-extension://abcdefgh/#my-page', 1), - Uri.parse('chrome-extension://abcdefgh/version.json?cachebuster=1'), - ); - expect( - plugin.versionJsonUrl( - 'chrome-extension://abcdefgh/a/b/c/#my-page', 1), - Uri.parse( - 'chrome-extension://abcdefgh/a/b/c/version.json?cachebuster=1'), - ); - }); + testWidgets('Get correct versionJsonUrl for chrome-extension', ( + tester, + ) async { + expect( + plugin.versionJsonUrl('chrome-extension://abcdefgh', 1), + Uri.parse('chrome-extension://abcdefgh/version.json?cachebuster=1'), + ); + expect( + plugin.versionJsonUrl('chrome-extension://abcdefgh/a/b/c', 1), + Uri.parse( + 'chrome-extension://abcdefgh/a/b/c/version.json?cachebuster=1', + ), + ); + expect( + plugin.versionJsonUrl('chrome-extension://abcdefgh/#my-page', 1), + Uri.parse('chrome-extension://abcdefgh/version.json?cachebuster=1'), + ); + expect( + plugin.versionJsonUrl('chrome-extension://abcdefgh/a/b/c/#my-page', 1), + Uri.parse( + 'chrome-extension://abcdefgh/a/b/c/version.json?cachebuster=1', + ), + ); + }); - testWidgets('Get correct versionJsonUrl for file', (tester) async { - expect( - plugin.versionJsonUrl('file://abcdefgh', 1), - Uri.parse('file:///version.json?cachebuster=1'), - ); - expect( - plugin.versionJsonUrl('file://abcdefgh/a/b/c', 1), - Uri.parse('file:///a/b/c/version.json?cachebuster=1'), - ); - expect( - plugin.versionJsonUrl('file://abcdefgh/#my-page', 1), - Uri.parse('file:///version.json?cachebuster=1'), - ); - expect( - plugin.versionJsonUrl('file://abcdefgh/a/b/c/#my-page', 1), - Uri.parse('file:///a/b/c/version.json?cachebuster=1'), - ); - }); - }, - ); + testWidgets('Get correct versionJsonUrl for file', (tester) async { + expect( + plugin.versionJsonUrl('file://abcdefgh', 1), + Uri.parse('file:///version.json?cachebuster=1'), + ); + expect( + plugin.versionJsonUrl('file://abcdefgh/a/b/c', 1), + Uri.parse('file:///a/b/c/version.json?cachebuster=1'), + ); + expect( + plugin.versionJsonUrl('file://abcdefgh/#my-page', 1), + Uri.parse('file:///version.json?cachebuster=1'), + ); + expect( + plugin.versionJsonUrl('file://abcdefgh/a/b/c/#my-page', 1), + Uri.parse('file:///a/b/c/version.json?cachebuster=1'), + ); + }); + }); group('Package Info Web (using MockAssetManager)', () { setUp(() { @@ -246,39 +243,35 @@ void main() { plugin = PackageInfoPlusWebPlugin(client, assetManagerMock); }); - testWidgets( - 'Get correct values when using the AssetManager baseUrl', - (tester) async { - const String baseUrl = 'https://an.example.com/using-asset-manager/'; - const String assetsDir = 'assets'; - final DateTime now = DateTime.now(); - final Clock fakeClock = Clock(() => now); + testWidgets('Get correct values when using the AssetManager baseUrl', ( + tester, + ) async { + const String baseUrl = 'https://an.example.com/using-asset-manager/'; + const String assetsDir = 'assets'; + final DateTime now = DateTime.now(); + final Clock fakeClock = Clock(() => now); - when(assetManagerMock.assetsDir).thenReturn(assetsDir); - when(assetManagerMock.getAssetUrl('')) - .thenReturn('$baseUrl$assetsDir/'); + when(assetManagerMock.assetsDir).thenReturn(assetsDir); + when(assetManagerMock.getAssetUrl('')).thenReturn('$baseUrl$assetsDir/'); - await withClock(fakeClock, () async { - final int cache = now.millisecondsSinceEpoch; + await withClock(fakeClock, () async { + final int cache = now.millisecondsSinceEpoch; - when(client.get( - Uri.parse('${baseUrl}version.json?cachebuster=$cache'), - )).thenAnswer( - (_) => Future.value( - http.Response(jsonEncode(VERSION_JSON), 200), - ), - ); + when( + client.get(Uri.parse('${baseUrl}version.json?cachebuster=$cache')), + ).thenAnswer( + (_) => Future.value(http.Response(jsonEncode(VERSION_JSON), 200)), + ); - final versionMap = await plugin.getAll(); + final versionMap = await plugin.getAll(); - expect(versionMap.appName, VERSION_JSON['app_name']); - expect(versionMap.version, VERSION_JSON['version']); - expect(versionMap.buildNumber, VERSION_JSON['build_number']); - expect(versionMap.packageName, VERSION_JSON['package_name']); - expect(versionMap.buildSignature, VERSION_JSON['build_signature']); - }); - }, - ); + expect(versionMap.appName, VERSION_JSON['app_name']); + expect(versionMap.version, VERSION_JSON['version']); + expect(versionMap.buildNumber, VERSION_JSON['build_number']); + expect(versionMap.packageName, VERSION_JSON['package_name']); + expect(versionMap.buildSignature, VERSION_JSON['build_signature']); + }); + }); testWidgets( 'Has preference for the custom base URL over the other 2 locations', @@ -290,26 +283,27 @@ void main() { final Clock fakeClock = Clock(() => now); when(assetManagerMock.assetsDir).thenReturn(assetsDir); - when(assetManagerMock.getAssetUrl('')) - .thenReturn('$managerBaseUrl$assetsDir/'); + when( + assetManagerMock.getAssetUrl(''), + ).thenReturn('$managerBaseUrl$assetsDir/'); await withClock(fakeClock, () async { final int cache = now.millisecondsSinceEpoch; - when(client.get( - Uri.parse('${customBaseUrl}version.json?cachebuster=$cache'), - )).thenAnswer( - (_) => Future.value( - http.Response(jsonEncode(VERSION_JSON), 200), + when( + client.get( + Uri.parse('${customBaseUrl}version.json?cachebuster=$cache'), ), + ).thenAnswer( + (_) => Future.value(http.Response(jsonEncode(VERSION_JSON), 200)), ); - when(client.get( - Uri.parse('${managerBaseUrl}version.json?cachebuster=$cache'), - )).thenAnswer( - (_) => Future.value( - http.Response(jsonEncode(VERSION_2_JSON), 200), + when( + client.get( + Uri.parse('${managerBaseUrl}version.json?cachebuster=$cache'), ), + ).thenAnswer( + (_) => Future.value(http.Response(jsonEncode(VERSION_2_JSON), 200)), ); final versionMap = await plugin.getAll(baseUrl: customBaseUrl); diff --git a/packages/package_info_plus/package_info_plus/example/integration_test/package_info_plus_web_test.mocks.dart b/packages/package_info_plus/package_info_plus/example/integration_test/package_info_plus_web_test.mocks.dart index bd10e30c8e..439eb05c78 100644 --- a/packages/package_info_plus/package_info_plus/example/integration_test/package_info_plus_web_test.mocks.dart +++ b/packages/package_info_plus/package_info_plus/example/integration_test/package_info_plus_web_test.mocks.dart @@ -26,34 +26,19 @@ import 'package:mockito/src/dummies.dart' as _i5; // ignore_for_file: subtype_of_sealed_class class _FakeResponse_0 extends _i1.SmartFake implements _i2.Response { - _FakeResponse_0( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeResponse_0(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeStreamedResponse_1 extends _i1.SmartFake implements _i2.StreamedResponse { - _FakeStreamedResponse_1( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeStreamedResponse_1(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeObject_2 extends _i1.SmartFake implements Object { - _FakeObject_2( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeObject_2(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } /// A class which mocks [Client]. @@ -65,46 +50,30 @@ class MockClient extends _i1.Mock implements _i2.Client { } @override - _i3.Future<_i2.Response> head( - Uri? url, { - Map? headers, - }) => + _i3.Future<_i2.Response> head(Uri? url, {Map? headers}) => (super.noSuchMethod( - Invocation.method( - #head, - [url], - {#headers: headers}, - ), - returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0( - this, - Invocation.method( - #head, - [url], - {#headers: headers}, - ), - )), - ) as _i3.Future<_i2.Response>); + Invocation.method(#head, [url], {#headers: headers}), + returnValue: _i3.Future<_i2.Response>.value( + _FakeResponse_0( + this, + Invocation.method(#head, [url], {#headers: headers}), + ), + ), + ) + as _i3.Future<_i2.Response>); @override - _i3.Future<_i2.Response> get( - Uri? url, { - Map? headers, - }) => + _i3.Future<_i2.Response> get(Uri? url, {Map? headers}) => (super.noSuchMethod( - Invocation.method( - #get, - [url], - {#headers: headers}, - ), - returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0( - this, - Invocation.method( - #get, - [url], - {#headers: headers}, - ), - )), - ) as _i3.Future<_i2.Response>); + Invocation.method(#get, [url], {#headers: headers}), + returnValue: _i3.Future<_i2.Response>.value( + _FakeResponse_0( + this, + Invocation.method(#get, [url], {#headers: headers}), + ), + ), + ) + as _i3.Future<_i2.Response>); @override _i3.Future<_i2.Response> post( @@ -114,28 +83,23 @@ class MockClient extends _i1.Mock implements _i2.Client { _i4.Encoding? encoding, }) => (super.noSuchMethod( - Invocation.method( - #post, - [url], - { - #headers: headers, - #body: body, - #encoding: encoding, - }, - ), - returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0( - this, - Invocation.method( - #post, - [url], - { - #headers: headers, - #body: body, - #encoding: encoding, - }, - ), - )), - ) as _i3.Future<_i2.Response>); + Invocation.method( + #post, + [url], + {#headers: headers, #body: body, #encoding: encoding}, + ), + returnValue: _i3.Future<_i2.Response>.value( + _FakeResponse_0( + this, + Invocation.method( + #post, + [url], + {#headers: headers, #body: body, #encoding: encoding}, + ), + ), + ), + ) + as _i3.Future<_i2.Response>); @override _i3.Future<_i2.Response> put( @@ -145,28 +109,23 @@ class MockClient extends _i1.Mock implements _i2.Client { _i4.Encoding? encoding, }) => (super.noSuchMethod( - Invocation.method( - #put, - [url], - { - #headers: headers, - #body: body, - #encoding: encoding, - }, - ), - returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0( - this, - Invocation.method( - #put, - [url], - { - #headers: headers, - #body: body, - #encoding: encoding, - }, - ), - )), - ) as _i3.Future<_i2.Response>); + Invocation.method( + #put, + [url], + {#headers: headers, #body: body, #encoding: encoding}, + ), + returnValue: _i3.Future<_i2.Response>.value( + _FakeResponse_0( + this, + Invocation.method( + #put, + [url], + {#headers: headers, #body: body, #encoding: encoding}, + ), + ), + ), + ) + as _i3.Future<_i2.Response>); @override _i3.Future<_i2.Response> patch( @@ -176,28 +135,23 @@ class MockClient extends _i1.Mock implements _i2.Client { _i4.Encoding? encoding, }) => (super.noSuchMethod( - Invocation.method( - #patch, - [url], - { - #headers: headers, - #body: body, - #encoding: encoding, - }, - ), - returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0( - this, - Invocation.method( - #patch, - [url], - { - #headers: headers, - #body: body, - #encoding: encoding, - }, - ), - )), - ) as _i3.Future<_i2.Response>); + Invocation.method( + #patch, + [url], + {#headers: headers, #body: body, #encoding: encoding}, + ), + returnValue: _i3.Future<_i2.Response>.value( + _FakeResponse_0( + this, + Invocation.method( + #patch, + [url], + {#headers: headers, #body: body, #encoding: encoding}, + ), + ), + ), + ) + as _i3.Future<_i2.Response>); @override _i3.Future<_i2.Response> delete( @@ -207,49 +161,36 @@ class MockClient extends _i1.Mock implements _i2.Client { _i4.Encoding? encoding, }) => (super.noSuchMethod( - Invocation.method( - #delete, - [url], - { - #headers: headers, - #body: body, - #encoding: encoding, - }, - ), - returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0( - this, - Invocation.method( - #delete, - [url], - { - #headers: headers, - #body: body, - #encoding: encoding, - }, - ), - )), - ) as _i3.Future<_i2.Response>); + Invocation.method( + #delete, + [url], + {#headers: headers, #body: body, #encoding: encoding}, + ), + returnValue: _i3.Future<_i2.Response>.value( + _FakeResponse_0( + this, + Invocation.method( + #delete, + [url], + {#headers: headers, #body: body, #encoding: encoding}, + ), + ), + ), + ) + as _i3.Future<_i2.Response>); @override - _i3.Future read( - Uri? url, { - Map? headers, - }) => + _i3.Future read(Uri? url, {Map? headers}) => (super.noSuchMethod( - Invocation.method( - #read, - [url], - {#headers: headers}, - ), - returnValue: _i3.Future.value(_i5.dummyValue( - this, - Invocation.method( - #read, - [url], - {#headers: headers}, - ), - )), - ) as _i3.Future); + Invocation.method(#read, [url], {#headers: headers}), + returnValue: _i3.Future.value( + _i5.dummyValue( + this, + Invocation.method(#read, [url], {#headers: headers}), + ), + ), + ) + as _i3.Future); @override _i3.Future<_i6.Uint8List> readBytes( @@ -257,39 +198,29 @@ class MockClient extends _i1.Mock implements _i2.Client { Map? headers, }) => (super.noSuchMethod( - Invocation.method( - #readBytes, - [url], - {#headers: headers}, - ), - returnValue: _i3.Future<_i6.Uint8List>.value(_i6.Uint8List(0)), - ) as _i3.Future<_i6.Uint8List>); + Invocation.method(#readBytes, [url], {#headers: headers}), + returnValue: _i3.Future<_i6.Uint8List>.value(_i6.Uint8List(0)), + ) + as _i3.Future<_i6.Uint8List>); @override _i3.Future<_i2.StreamedResponse> send(_i2.BaseRequest? request) => (super.noSuchMethod( - Invocation.method( - #send, - [request], - ), - returnValue: - _i3.Future<_i2.StreamedResponse>.value(_FakeStreamedResponse_1( - this, - Invocation.method( - #send, - [request], - ), - )), - ) as _i3.Future<_i2.StreamedResponse>); + Invocation.method(#send, [request]), + returnValue: _i3.Future<_i2.StreamedResponse>.value( + _FakeStreamedResponse_1( + this, + Invocation.method(#send, [request]), + ), + ), + ) + as _i3.Future<_i2.StreamedResponse>); @override void close() => super.noSuchMethod( - Invocation.method( - #close, - [], - ), - returnValueForMissingStub: null, - ); + Invocation.method(#close, []), + returnValueForMissingStub: null, + ); } /// A class which mocks [AssetManager]. @@ -301,50 +232,42 @@ class MockAssetManager extends _i1.Mock implements _i7.AssetManager { } @override - String get assetsDir => (super.noSuchMethod( - Invocation.getter(#assetsDir), - returnValue: _i5.dummyValue( - this, - Invocation.getter(#assetsDir), - ), - ) as String); + String get assetsDir => + (super.noSuchMethod( + Invocation.getter(#assetsDir), + returnValue: _i5.dummyValue( + this, + Invocation.getter(#assetsDir), + ), + ) + as String); @override - String getAssetUrl(String? asset) => (super.noSuchMethod( - Invocation.method( - #getAssetUrl, - [asset], - ), - returnValue: _i5.dummyValue( - this, - Invocation.method( - #getAssetUrl, - [asset], - ), - ), - ) as String); + String getAssetUrl(String? asset) => + (super.noSuchMethod( + Invocation.method(#getAssetUrl, [asset]), + returnValue: _i5.dummyValue( + this, + Invocation.method(#getAssetUrl, [asset]), + ), + ) + as String); @override - _i3.Future loadAsset(String? asset) => (super.noSuchMethod( - Invocation.method( - #loadAsset, - [asset], - ), - returnValue: _i3.Future.value(_FakeObject_2( - this, - Invocation.method( - #loadAsset, - [asset], - ), - )), - ) as _i3.Future); + _i3.Future loadAsset(String? asset) => + (super.noSuchMethod( + Invocation.method(#loadAsset, [asset]), + returnValue: _i3.Future.value( + _FakeObject_2(this, Invocation.method(#loadAsset, [asset])), + ), + ) + as _i3.Future); @override - _i3.Future<_i6.ByteData> load(String? asset) => (super.noSuchMethod( - Invocation.method( - #load, - [asset], - ), - returnValue: _i3.Future<_i6.ByteData>.value(_i6.ByteData(0)), - ) as _i3.Future<_i6.ByteData>); + _i3.Future<_i6.ByteData> load(String? asset) => + (super.noSuchMethod( + Invocation.method(#load, [asset]), + returnValue: _i3.Future<_i6.ByteData>.value(_i6.ByteData(0)), + ) + as _i3.Future<_i6.ByteData>); }