flame-engine / flame

A Flutter based game engine.
https://flame-engine.org
MIT License
9.23k stars 902 forks source link

flame-1.9.1/lib/src/game/flame_game.dart:279:30: Error: Member not found: 'hidden'. #2778

Closed kavi6024 closed 1 year ago

kavi6024 commented 1 year ago

This is the first time I am working with the Flame framework, and following the tutorial provided on Bare Flame game, I have this code.

`import 'package:flame/game.dart'; import 'package:flutter/widgets.dart';

void main() { final game = FlameGame(); runApp(GameWidget(game: game)); }`

Current bug behavior

This is the behaviour of the program when I run it. (M2101K7BI is my physical device's name)

`Launching lib\main.dart on M2101K7BI in debug mode... Running Gradle task 'assembleDebug'... ../../../../AppData/Local/Pub/Cache/hosted/pub.dev/flame-1.9.1/lib/src/game/flame_game.dart:279:30: Error: Member not found: 'hidden'. case AppLifecycleState.hidden: ^^^^^^ Target kernel_snapshot failed: Exception

FAILURE: Build failed with an exception.

BUILD FAILED in 18s Exception: Gradle task assembleDebug failed with exit code 1 `

Steps to reproduce

This error occurred the first time I ran the program, so I don't exactly know the procedure to reproduce the same.

Flutter doctor output

[√] Flutter (Channel stable, 3.10.6, on Microsoft Windows [Version 10.0.19045.3324], locale en-IN)
    • Flutter version 3.10.6 on channel stable at C:\Users\user\Flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f468f3366c (3 months ago), 2023-07-12 15:19:05 -0700
    • Engine revision cdbeda788a
    • Dart version 3.0.6
    • DevTools version 2.23.1

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Program Files\Android\Sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[!] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.0)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.1.32210.238
    X The current Visual Studio installation is incomplete. Please reinstall Visual Studio.

[√] Android Studio (version 2022.3)
    • 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 17.0.6+0-b2043.56-10027231)

[√] VS Code, 64-bit edition (version 1.81.1)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 3.56.0

[√] Connected device (4 available)
    • M2101K7BI (mobile) • IRGEH6ZLDUTGT86H • android-arm64  • Android 12 (API 31)
    • Windows (desktop)  • windows          • windows-x64    • Microsoft Windows [Version 10.0.19045.3324]
    • Chrome (web)       • chrome           • web-javascript • Google Chrome 117.0.5938.92
    • Edge (web)         • edge             • web-javascript • Microsoft Edge 117.0.2045.41

[√] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

More environment information

wolfenrain commented 1 year ago

It seems we haven't updated the Flutter constraints of Flame but since the latest Flame version we dont support Flutter 3.10 anymore because Flutter introduced a breaking change: https://docs.flutter.dev/release/breaking-changes/add-applifecyclestate-hidden

kavi6024 commented 1 year ago

Any way to change the AppLifecycleState enum, or to implement it maunally ? Or, is there any update coming up on Flame ?

spydon commented 1 year ago

Any way to change the AppLifecycleState enum, or to implement it maunally ? Or, is there any update coming up on Flame ?

Can't you just update your Flutter version? In the next release we'll update the constraints.