magiclabs / magic-flutter

Apache License 2.0
10 stars 5 forks source link

Type Mismatch Error in agent_dart Causing Build Failure #63

Open ideasidus opened 6 months ago

ideasidus commented 6 months ago

I tried to build a test demo for Flutter, but it throws an exception

I tried the agent_dart package in the error message below with both 1.0.0-dev.8, which is a requirement of secp256r1: 0.1.0-dev.7, and 1.0.0-dev.22, the most recent version, but only 1.0.0-dev.20 was available in the dependency check.

Does agent_dart need any modification or do I need to use a specific flutter & dart version?

Attempted Solutions:

Desired Outcome:

I would appreciate any guidance on resolving this type mismatch error and successfully building my Flutter project.

Environment:

Error Message:

PS C:\Users\user\FlutterProjects\magic-flutter\magic_demo> flutter run
Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
You are applying Flutter's app_plugin_loader Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/go/flutter-gradle-plugin-apply

You are applying Flutter's main Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/go/flutter-gradle-plugin-apply

../../../AppData/Local/Pub/Cache/hosted/pub.dev/agent_dart-1.0.0-dev.20/lib/archiver/encoder.dart:162:8: Error: The return type of the method 'SingingBlockZipFileEncoder.close' is 'void', which does not match the return type, 'Future<void>', of the overridden method, 'ZipFileEncoder.close'.
 - 'Future' is from 'dart:async'.
Change to a subtype of 'Future<void>'.
  void close() {
       ^
../../../AppData/Local/Pub/Cache/hosted/pub.dev/archive-3.5.1/lib/src/io/zip_file_encoder.dart:235:16: Context: This is the overridden method ('close').
  Future<void> close() async {
               ^
Target kernel_snapshot failed: Exception

FAILURE: Build failed with an exception.

* Where:
Script 'C:\Users\user\flutter\packages\flutter_tools\gradle\src\main\groovy\flutter.groovy' line: 1419

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\Users\user\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 18s
Running Gradle task 'assembleDebug'...                             18.8s
Error: Gradle task assembleDebug failed with exit code 1
rsnay commented 4 months ago

I'm running into this same problem.

This issue was reported on agent_dart: https://github.com/AstroxNetwork/agent_dart/issues/76 and resolved in agent_dart 1.0.0-dev.23: https://github.com/AstroxNetwork/agent_dart/pull/77

But if I update to that version of agent_dart, I'm still unable to build my flutter app, because magic_sdk is incompatible with that version of agent_dart:

Because agent_dart >=1.0.0-dev.21 depends on flutter_rust_bridge ^1.82.6 which depends on uuid ^4.1.0, agent_dart >=1.0.0-dev.21 requires uuid ^4.1.0.
And because magic_sdk 6.0.1 depends on uuid ^3.0.7 and no versions of magic_sdk match >6.0.1 <7.0.0, agent_dart >=1.0.0-dev.21 is incompatible with magic_sdk ^6.0.1.
So, because recap depends on both magic_sdk ^6.0.1 and agent_dart ^1.0.0-dev.23, version solving failed.
BrunoEleodoro commented 2 months ago

I have the same issue on my side, upgrading agent_dart 1.0.0-dev.23: break other dependencies

BrunoEleodoro commented 2 months ago

@rsnay this might be a temporary fix:

dependency_overrides:
  agent_dart: ^1.0.0-dev.23
  flutter_rust_bridge: ^1.82.6
  uuid: ^4.1.0

I've forced the dependencies like this, seems that it broke something else, but maybe it works on your side.