Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter: Error: Getter not found: 'suspending'. case AppLifecycleState.suspending

I just upgraded Flutter on Stable Channel and got the following StackTrace, when trying to launch an App (on local iOS Simulator). Running unit-tests with flutter test are also affected.

Launching lib/main.dart on iPhone 8 in debug mode...

Compiler message:
../../flutter/.pub-cache/hosted/pub.dartlang.org/native_device_orientation-0.1.2/lib/native_device_orientation.dart:149:30: Error: Getter not found: 'suspending'.
      case AppLifecycleState.suspending:
                             ^^^^^^^^^^
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
Failed to build bundle.
Error launching application on iPhone 8.

Flutter doctor -v

[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.14.6 18G1012, locale de-DE)
    • Flutter version 1.12.13+hotfix.5
    • Framework revision 27321ebbad (33 hours ago), 2019-12-10 18:15:01 -0800
    • Engine revision 2994f7e1e6
    • Dart version 2.7.0


[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0-rc2)
    • Android SDK at ...Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.0-rc2
    • Java binary at: .../bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3, Build version 11C29
    • CocoaPods version 1.6.0

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 42.1.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] Connected device (1 available)
    • iPhone 8 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)

• No issues found!

Anybody got a solution?

like image 548
Max Avatar asked Dec 12 '19 11:12

Max


Video Answer


2 Answers

I had the same issue.

Please have a look at the changelog of the native_device_orientation package:

"Breaking change to support the fact that AppLifecycleState.suspended has changed to AppLifecycleState.detached."

One of your packages may depends on this library. Here you can find a list of the packages https://pub.dev/packages?q=dependency%3Anative_device_orientation.

For me it was qr_mobile_vision.

like image 67
x23b5 Avatar answered Oct 04 '22 17:10

x23b5


To make the answer slightly more broader in scope than the one already submitted by @x23b5, it is indeed caused by this PR into the flutter master channel on Nov 4th.

The PR updated the enum: AppLifecycleState.suspending to AppLifecycleState.detached.

You may be using a dependency in one of your plugins that relies on this enum such as one of these - in which case your debug error message will point you towards that plugin - then simply visit its github repo and see if the author has issued a patch. If not, feel free to edit that single line and submit a PR for them.

If on the other hand you've manually written code (like my case) that leveraged AppLifecycleState, search your code for it and manually update suspending to detached and restart flutter.

like image 21
altShiftDev Avatar answered Oct 04 '22 15:10

altShiftDev