Closed naveenbharadwaj19 closed 3 years ago
a) I do have a fix for avoiding the NoSuchElementException on hot reload (will merge in the near future). b) However, see https://github.com/dart-lang/sdk/issues/44640 - even after we fix the crash, a hot reload will re-spawn the isolate successfully, but only with the original code. The hot reload won't reflect anything that was changed inside the isolate. This is a Dart issue that hasn't been fixed yet.
I'm not 100% sure (I need to look into it a bit further), but I strongly suspect you should kill any isolate after it's finished its work. This is the approach taken in Flutter compute()
so I advise you do the same.
@nmfisher what about the Platformexception ? The following PlatformException was thrown while activating platform stream on channel com.rmawatson.flutterisolate/event:
PlatformException(error, null, null, null)
When the exception was thrown, this was the stack
#0 StandardMethodCodec.decodeEnvelope
package:flutter/…/services/message_codecs.dart:581
#1 MethodChannel._invokeMethod
package:flutter/…/services/platform_channel.dart:158
<asynchronous suspension>
FlutterIsolate.spawn(fun,msg)
inside the button i'm getting a log message skipping x frames .The application may be doing too much work on its main thread
why ? I suspect the PlatformException is simply thrown due to the NoSuchElementException being thrown, so fixing the latter should fix the former.
For the "application may be doing too much work on its main thread", do you see this in profile/release mode or just debug mode? I encounter this regularly and just attribute it to the usual sluggishness of Flutter's debug mode. I believe it's a warning propagated from Android's main thread (which is different from Flutter's main thread), which is intended to tell Android developers that they should be moving certain work off-thread. Unless it's causing noticeable jank in a release build, I would ignore it.
@nmfisher
I suspect the PlatformException is simply thrown due to the NoSuchElementException being thrown, so fixing the latter should fix the former.
Do i need to wait for flutter_isolate
new version ?
do you see this in profile/release mode or just debug mode?
Yes i'm seeing it on debug mode . I haven't tried with profile/release mode
Yes, you will need to wait for the next version for the hot reload fix.
On 25 Apr 2021, at 3:14 PM, Mr_Robot @.***> wrote:
@nmfisher
I suspect the PlatformException is simply thrown due to the NoSuchElementException being thrown, so fixing the latter should fix the former.
Do i need to wait for flutter_isolate new version ?
do you see this in profile/release mode or just debug mode?
Yes i'm seeing it on debug mode . I haven't tried with profile/release mode
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
UP!
This should be fixed by https://github.com/rmawatson/flutter_isolate/pull/78, you can try 2.0.1-pre
on pub and reopen this issue if you're still experiencing errors.
plugin version : 2.0.0
flutter doctor -v`
``` [√] Flutter (Channel stable, 2.0.2, on Microsoft Windows [Version 10.0.19041.867], locale en-IN) • Flutter version 2.0.2 at D:\OTHER FILES D\CS ALL FOLD\Flutter main sdk\flutter • Framework revision 8962f6dc68 (6 weeks ago), 2021-03-11 13:22:20 -0800 • Engine revision 5d8bf811b3 • Dart version 2.12.1 [√] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at D:\Android_SDK • Platform android-30, build-tools 30.0.3 • ANDROID_HOME = D:\Android_SDK • Java binary at: D:\Android studio main\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01) • All Android licenses accepted. [√] Chrome - develop for the web • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe [√] Android Studio (version 4.1.0) • Android Studio at D:\Android studio main • 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\bhara\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.18.1 [√] Connected device (3 available) • Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator) • Chrome (web) • chrome • web-javascript • Google Chrome 89.0.4389.128 • Edge (web) • edge • web-javascript • Microsoft Edge 90.0.818.42 • No issues found! ```Error when hot restarted :
Code :