Closed ronjb closed 2 weeks ago
Here's a link to the sample app for reproducing the bug in DartPad: DartPad example
Looks like this bug is a duplicate of https://github.com/flutter/flutter/issues/144087, which has been fixed, just hasn't made it to stable yet.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v
and a minimal reproduction of the issue.
Steps to reproduce
Expected results
Expected exception to not be thown.
Actual results
Exception was thrown. See the Logs for details.
Code sample
Code sample
```dart import 'package:flutter/material.dart'; void main() { runApp(const MaterialApp(home: MyHomePage())); } class MyHomePage extends StatefulWidget { const MyHomePage({super.key}); @override StateScreenshots or Video
Screenshots / Video demonstration
[Upload media here]Logs
Logs
```console Launching lib/main.dart on Chrome in debug mode... This app is linked to the debug service: ws://127.0.0.1:53608/FENKUkPN7nc=/ws Debug service listening on ws://127.0.0.1:53608/FENKUkPN7nc=/ws Connecting to VM Service at ws://127.0.0.1:53608/FENKUkPN7nc=/ws ══╡ EXCEPTION CAUGHT BY ANIMATION LIBRARY ╞═════════════════════════════════════════════════════════ The following assertion was thrown while notifying listeners for AnimationController: setState() called after dispose(): _AnimatedState#e0e73(lifecycle state: defunct, not mounted) This error happens if you call setState() on a State object for a widget that no longer appears in the widget tree (e.g., whose parent widget no longer includes the widget in its build). This error can occur when code calls setState() from a timer or an animation callback. The preferred solution is to cancel the timer or stop listening to the animation in the dispose() callback. Another solution is to check the "mounted" property of this object before calling setState() to ensure the object is still in the tree. This error might indicate a memory leak if setState() is being called because another object is retaining a reference to this State object after it has been removed from the tree. To avoid memory leaks, consider breaking the reference to this object during dispose(). When the exception was thrown, this was the stack: dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 297:3 throw_ packages/flutter/src/widgets/framework.dart 1167:9Flutter Doctor output
Doctor output
```console √ ~/Development/flutter_app_tests 🌀 flutter doctor -v [✓] Flutter (Channel stable, 3.19.6, on macOS 14.4.1 23E224 darwin-arm64, locale en-US) • Flutter version 3.19.6 on channel stable at /Users/ronbooth/Development/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 54e66469a9 (2 weeks ago), 2024-04-17 13:08:03 -0700 • Engine revision c4cd48e186 • Dart version 3.3.4 • DevTools version 2.31.1 [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/ronbooth/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 15.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15E204a • CocoaPods version 1.15.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2023.3) • Android Studio at /Applications/Android Studio.app/Contents • 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.10+0-17.0.10b1087.21-11572160) [✓] VS Code (version 1.88.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.88.0 [✓] Connected device (4 available) • Ron’s iPad Pro (mobile) • 00008103-00084486018A001E • ios • iOS 17.4.1 21E236 • iPad mini (6th generation) (mobile) • AEABF899-FFD4-41D8-9757-0320607C6F2B • ios • com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 14.4.1 23E224 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 124.0.6367.119 [✓] Network resources • All expected network resources are available. • No issues found! √ ~/Development/flutter_app_tests 🌀 ```