FilledStacks / testsweets

A utility package for TestSweets that allows you to generate and upload your automation keys for the TestSweets tool
26 stars 5 forks source link

Error: The argument type 'Overlay Function()' can't be assigned to the parameter type 'Widget Function(BuildContext, Widget?)? #79

Closed matszafraniec closed 4 months ago

matszafraniec commented 4 months ago

Hi,

I've tried to use testsweets package ver. 1.5.2 (can't update it to the latest due to packages dependency issue).

Here is my App class:

   GetMaterialApp(
        title: 'MyAppName',
        themeMode: ThemeMode.light,
        theme: AppTheme.base,
        getPages: Routes.pages,
        locale: LocalizationService.locale,
        fallbackLocale: LocalizationService.fallbackLocale,
        translations: LocalizationService(),
        debugShowCheckedModeBanner: false,
        navigatorObservers: [
          TestSweetsNavigatorObserver(),
        ],
        builder: (context, child) => TestSweetsOverlayView(
          projectId: '>>myProjectId<<',
          child: child!,
        ),
      ),

When compiling, I'm getting an error as presented below (Android build):

 - 'Overlay' is from 'package:flutter/src/widgets/overlay.dart' ('../../flutter/packages/flutter/lib/src/widgets/overlay.dart').
 - 'Widget' is from 'package:flutter/src/widgets/framework.dart' ('../../flutter/packages/flutter/lib/src/widgets/framework.dart').
 - 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('../../flutter/packages/flutter/lib/src/widgets/framework.dart').
          builder: () => Overlay(
                   ^
../../../.pub-cache/hosted/pub.dev/stacked-2.3.15+1/lib/src/state_management/skeleton_loader.dart:106:19: Error: No named parameter with the name 'vsync'.
                  vsync: this,
                  ^^^^^
../../flutter/packages/flutter/lib/src/widgets/animated_size.dart:28:9: Context: Found this candidate, but the arguments don't match.
  const AnimatedSize({
        ^^^^^^^^^^^^
../../../.pub-cache/hosted/pub.dev/stacked_core-1.2.4/lib/src/code_generation/locator/stacked_locator.dart:405:19: Error: The argument type 'Object?' can't be assigned to the parameter type 'T?'.
 - 'Object' is from 'dart:core'.
        instance: instance,
                  ^
Target kernel_snapshot failed: Exception

My configuration:

[!] Flutter (Channel [user-branch], 3.13.6, on macOS 14.2.1 23C71 darwin-arm64, locale en-PL)
    ! Flutter version 3.13.6 on channel [user-branch] at /Users/mat/Documents/flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install.
    ! Upstream repository unknown source is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error.
    • Framework revision ead455963c (5 months ago), 2023-09-26 18:28:17 -0700
    • Engine revision a794cf2681
    • Dart version 3.1.3
    • DevTools version 2.25.0
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and
      upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/mat/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15C65
    • CocoaPods version 1.13.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • android-studio-dir = /Applications/Android Studio.app
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] VS Code (version 1.86.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.70.0

[✓] Connected device (3 available)
    • iPhone 15 Pro (mobile) • DAF45E4A-86E9-4F40-AEE1-C9CDD4BD9B7B • ios            • com.apple.CoreSimulator.SimRuntime.iOS-17-0 (simulator)
    • macOS (desktop)        • macos                                • darwin-arm64   • macOS 14.2.1 23C71 darwin-arm64
    • Chrome (web)           • chrome                               • web-javascript • Google Chrome 121.0.6167.160

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.
FilledStacks commented 4 months ago

Interesting.

I don't use Get but let me see if I can fix that error with a workaround on my side.

FilledStacks commented 4 months ago

Hi, I can't reproduce this with the latest package version.

What's the clash you're getting in the latest version, maybe I can help you fix that so you can use the latest version.

matszafraniec commented 4 months ago

Thanks for your support. When I'm trying to upgrade testsweets to the latest version I have a conflict with one of my package responsible for handling payments. It is related to http package.

Below you can find error log:

Because testsweets >=1.8.9 depends on http ^1.1.0 and [my_payments_package] 2.1.20 depends on http ^0.13.1, testsweets >=1.8.9 is incompatible with [my_payments_package] 2.1.20.
And because no versions of [my_payments_package] match >2.1.20 <3.0.0, testsweets >=1.8.9 is incompatible with [my_payments_package] ^2.1.20.
So, because [my_app] depends on both [my_payments_package] ^2.1.20 and testsweets ^1.14.0, version solving failed.

You can try the following suggestion to make the pubspec resolve:
* Consider downgrading your constraint on testsweets: flutter pub add testsweets:^1.5.2
FilledStacks commented 4 months ago

Mmmmmm, I see.

Can you try to add the following to your pubspec file

dependency_overrides:
  http: 0.13.1

Ensure that the spacing infront of http is a tab since it'll be 2 spaces when you copy from here.

matszafraniec commented 4 months ago

Yep. It is working now, thank you!