Package Conflict in Flutter how to resolve? - flutter

When creating a QR Code reader app in VSCode, I wanted to use two different packages and implement certain functionalities from both, since one package has some functionality that the other does not.
The two packages in question are:
qr_code_scanner
qrscan
While I had been working on the project with only the first (qr_code_scanner) package added to my pubspec.yaml, the project could compile and run. However, once I added the second (qrscan) package to my pubspec.yaml, my project could not compile and would show the error.
\android\app\src\main\kotlin\com\example\qrcodereader\MainActivity.kt: (14, 49): Unresolved reference: onFlutterViewDestroyed
Wondering if it is possible to resolve this issue, or if not possible, how I can restore to a previously working state, since removing either package from my pubspec.yaml does not remove the package from my flutter project.
If required, flutter doctor:
[√] Flutter (Channel stable, 1.22.2, on Microsoft Windows [Version 10.0.19041.572], locale en-US)
• Flutter version 1.22.2 at C:\src\flutter
• Framework revision 84f3d28555 (5 days ago), 2020-10-15 16:26:19 -0700
• Engine revision b8752bbfff
• Dart version 2.10.2
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at C:\Users\Daniel Seah\AppData\Local\Android\sdk
• Platform android-29, build-tools 29.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 47.1.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.50.1)
• VS Code at C:\Users\Daniel Seah\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.15.1
[√] Connected device (2 available)

Related

Vscode showing white theme/text in my flutter dart code

In the image above you can see that the whole dart code is showing white lines and this happened after my laptop accidently turned off while I was running the code.
The first error it gave was corrupted .git/packed-ref file which i fixed but this one isn't going away, other file type is showing their repective color theme only the .dart file is doing this. and also dart analyzer isn't working too
//Flutter doctor -v
[√] Flutter (Channel stable, 2.8.0, on Microsoft Windows [Version 6.3.9600], locale en-US)
• Flutter version 2.8.0 at D:\flutter\Sdk\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision cf44000065 (8 weeks ago), 2021-12-08 14:06:50 -0800
• Engine revision 40a99c5951
• Dart version 2.15.0
[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc2)
• Android SDK at C:\Users\bright\AppData\Local\Android\sdk
• Platform android-31, build-tools 31.0.0-rc2
• Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
• All Android licenses accepted.
[X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[√] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio1
• Flutter plugin version 44.0.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[√] VS Code (version 1.63.2)
• VS Code at C:\Users\bright\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.34.0
[√] Connected device (1 available)
• Edge (web) • edge • web-javascript • Microsoft Edge 97.0.1072.69
! Doctor found issues in 1 category.
I don't exactly know what the problem is, since it isn't showing me any error. Please what do i do?
I think there is something wrong with the Dart extension (perhaps some files are corrupt), but uninstalling/re-installing it does not remove the files from disk and re-download it.
I would try uninstalling the Dart extension, then go into your %USERPROFILE%\.vscode\extensions folder and delete any dart-code.dart-code folders, and then re-launch VS Code and re-install it.
If that doesn't solve it, please file an issue at https://github.com/Dart-Code/Dart-Code. Thanks!

flutter code display error in visual studio code

Initially this code is correct but after I reinstalled Windows and its applications, the project that was correct is now an error.
My project error
flutter doctor -v :
[√] Flutter (Channel dev, 1.26.0-1.0.pre, on Microsoft Windows [Version 10.0.19042.804], locale en-US)
• Flutter version 1.26.0-1.0.pre at F:\src\flutter
• Framework revision 63062a6443 (9 weeks ago), 2020-12-13 23:19:13 +0800
• Engine revision 4797b06652
• Dart version 2.12.0 (build 2.12.0-141.0.dev)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at F:\src\Android\Sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Android Studio (version 4.1.0)
• Android Studio at C:\Program Files\Android\Android Studio
• 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
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.53.2)
• VS Code at C:\Users\hyda\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.19.0
[√] Connected device (1 available)
• sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
• No issues found!
The error you get is because the libraries are not loaded. First, go to the pubseck.yaml file and get the packages there. If still not working see this command
-> flutter clean
-> flutter pub get
Such problems can be solved by running this command:
flutter clean
Once that is done, go to pubspec.yaml and check if all the packages are still there. For cross-checking, run:
flutter pub get
This will solve your problem.

Upgrading camera_platform_interface from 1.0.4 to 1.2.0 results in camera not working

There's no error logs printed, so it's difficult to provide some more information about what is causing this. With the same code base, same camera plugin version (0.6.3+2), if I run flutter pub upgrade and camera_platform_interface bumps from 1.0.4 to 1.2.0, parts of our app that use the camera stop working (black screen).
[√] Flutter (Channel stable, 1.22.5, on Microsoft Windows [Versión 10.0.19042.685], locale es-ES)
• Flutter version 1.22.5 at C:\src\flutter
• Framework revision 7891006299 (3 weeks ago), 2020-12-10 11:54:40 -0800
• Engine revision ae90085a84
• Dart version 2.10.4
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\crist\AppData\Local\Android\Sdk
• Platform android-30, build-tools 30.0.3
• ANDROID_HOME = C:\Users\crist\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[!] Android Studio (version 4.1.0)
• Android Studio at C:\Program Files\Android\Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] Connected device (1 available)
• ONEPLUS A5000 (mobile) • f2eb43ee • android-arm64 • Android 10 (API 29)
! Doctor found issues in 1 category.
You can use a dependency override to workaround the problem.
Adding the following to your pubspec.yaml should solve the issue:
dependency_overrides:
camera_platform_interface: ">=1.0.4 <1.1.0"

Dart code snippets don't show in-line with stacktraces on the sentry dashboard

Stacktraces from python - beautiful inline code
Stacktraces from dart - no inline code snippets :(
I understand that python is a super dynamic language and can pick up the code using magic like the inspect module, but is there a way to "give" sentry my dart code too?
Dupe of flutter/#63276
fluter doctor -v
[✓] Flutter (Channel stable, v1.17.5, on Mac OS X 10.14.6 18G4032, locale en)
• Flutter version 1.17.5 at /Users/dev/Tools/flutter
• Framework revision 8af6b2f038 (6 weeks ago), 2020-06-30 12:53:55 -0700
• Engine revision ee76268252
• Dart version 2.8.4
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/dev/Library/Android/sdk
• Platform android-29, build-tools 29.0.3
• Java binary at: /Users/dev/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-1/192.6392135/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.2.1, Build version 11B500
• CocoaPods version 1.8.4
[✓] Android Studio (version 3.6)
• Android Studio at /Users/dev/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-1/192.6392135/Android
Studio.app/Contents
• Flutter plugin version 45.1.1
• Dart plugin version 192.8052
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
[✓] VS Code (version 1.46.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.12.1
[✓] Connected device (1 available)
• POCO F1 • e19ec1f6 • android-arm64 • Android 10 (API 29)
• No issues found!
This is not yet supported.
It might not be possible to add at all since it depends on some level of support from the platform. One approach is to allow users to run sentry-cli to upload a "source bundle" and on the server we lookup the relevant lines of code on that bundle as the events come in. This is done for some platforms.
I'll update this answer if the situation changes.
I made a comment on the GitHub issue too.

App keeps crashing after recent upgrade to new versions of Flutter( v1.12.13+hotfix.8) and other libraries

App is crashing with following error message in some devices. Its not happening in all devices.
Fatal Exception: java.lang.UnsupportedOperationException
The new embedding does not support the old FlutterView.
io.flutter.embedding.engine.plugins.shim.ShimRegistrar.view (ShimRegistrar.java:82)
io.flutter.plugins.camera.CameraPlugin.registerWith (CameraPlugin.java:54)
io.flutter.plugins.GeneratedPluginRegistrant.registerWith (GeneratedPluginRegistrant.java:47)
com.pickcel.taskmanagement.Application.registerWith (Application.java:22)
com.transistorsoft.flutter.backgroundgeolocation.HeadlessTask.startBackgroundIsolate (HeadlessTask.java:186)
com.transistorsoft.flutter.backgroundgeolocation.HeadlessTask.dispatch (HeadlessTask.java:94)
com.transistorsoft.flutter.backgroundgeolocation.HeadlessTask.run (HeadlessTask.java:88)
Device list :
Xiaomi (Note 7 pro, poco f1, etc)
Samsung (Galaxy M30, S10, A50)
HMD Global (Nokia 4.2, 2.2),
** Mostly with Android OS - PIE(9)
It caused 6K+ crashes till now. I have check the project and i'm not using ShimRegistrar anywhere.
I was also receiving this very same (annoying) errors and also using the background_fetch plugin. Once my app was terminated it wasn't possible to make the background_fetch wake it up without trapping into a FATAL error.
It happens that this plugin was recently updated to a new V2 plugin API standard and it requires that many small changes are made in the "Android side" of your Flutter project.
I strongly recommend that you follow these instructions:
https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects
After that please compare your AndroidManifest.xml, Application.java, MainActivity.java and styles.xml files with the ones available at:
https://github.com/transistorsoft/flutter_background_fetch/tree/master/example/android/app/src/main
My Flutter Doctor results in case you want to compare with yours.
[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.18363.720], locale en-US)
• Flutter version 1.12.13+hotfix.8 at D:\Tools\flutter
• Framework revision 0b8abb4724 (5 weeks ago), 2020-02-11 11:44:36 -0800
• Engine revision e1e6ced81d
• Dart version 2.7.0
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at D:\Android\android-sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = C:\Android\android-sdk
• ANDROID_SDK_ROOT = C:\Android\android-sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
• All Android licenses accepted.
[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 44.0.2
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[√] VS Code, 32-bit edition
• VS Code at C:\Program Files (x86)\Microsoft VS Code
• Flutter extension version 3.8.1
[√] VS Code, 64-bit edition (version 1.43.0)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.8.1