After I used pub upgrade
I got this error and I don’t know why. Although I comment on the crypto
package(I see the crypto
is a path in the error) this error still appears.
Launching libmain.dart on Chrome in debug mode...
Waiting for connection from debug service on Chrome...
/C:/Users/user/AppData/Local/Pub/Cache/hosted/pub.dev/basic_utils-5.5.1/lib/src/library/crypto/rc2_engine.dart:4:1: Error: 'RC2Parameters' is imported from both 'package:basic_utils/src/library/crypto/rc2_parameters.dart' and 'package:pointycastle/api.dart'.
import 'package:pointycastle/export.dart';
^^^^^^^^^^^^^
Failed to compile the application.
I tried to ctrl+shift+f to find package:basic_utils/src/library/crypto/rc2_parameters.dart
and RC2Parameters
but this is not found.
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.7.5, on Microsoft Windows [Version 10.0.19045.2728], locale th-TH)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.5)
[√] Android Studio (version 2022.1)
[√] IntelliJ IDEA Community Edition (version 2022.2)
[√] VS Code (version 1.76.2)
[√] Connected device (3 available)
[√] HTTP Host Availability
• No issues found!
2
Answers
The
basic_utils
is the cause of this issue.This error happened when importing any package that has a dependency on
basic_utils
, either direct or transitive as mentioned in github.For me, this package that uses the
basic_utils
is themongo_dart
.The solution that can fix this issue before the maintainer of the
basic_utils
package fixes this is to override the dependency by adding the following lines in thepubspec.yaml
as mentioned in github:You can override the package