-
Notifications
You must be signed in to change notification settings - Fork 26.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed assertion: line 651 pos 12 in package:flutter/src/widgets/heroes.dart #115358
Comments
In the other way:
and see an exception:
Error looks like #108363 Is it possible two issues in one sample code? Or need to open new issue? |
Hi @mokhin-denis, thanks for filing the issue. This issue is reproducible on the latest Exception log
flutter doctor -v (stable and master)[✓] Flutter (Channel stable, 3.3.8, on macOS 13.0 22A380 darwin-x64, locale en-VN)
• Flutter version 3.3.8 on channel stable at /Users/huynq/Documents/GitHub/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 52b3dc25f6 (23 hours ago), 2022-11-09 12:09:26 +0800
• Engine revision 857bd6b74c
• Dart version 2.18.4
• DevTools version 2.15.0
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/huynq/Library/Android/sdk
• Platform android-33, build-tools 31.0.0
• ANDROID_HOME = /Users/huynq/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14A400
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.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 11.0.13+0-b1751.21-8125866)
[✓] IntelliJ IDEA Community Edition (version 2022.2.2)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 70.0.5
• Dart plugin version 222.4167.21
[✓] IntelliJ IDEA Community Edition (version 2022.1.1)
• IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.app
• 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
[✓] VS Code (version 1.73.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.52.0
[✓] Connected device (3 available)
• iPhone 14 Pro Max (mobile) • 332079AF-E895-4685-910E-7B1E18B0C6B8 • ios • com.apple.CoreSimulator.SimRuntime.iOS-16-0 (simulator)
• macOS (desktop) • macos • darwin-x64 • macOS 13.0 22A380 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 107.0.5304.110
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
[!] Flutter (Channel master, 3.6.0-3.0.pre.48, on macOS 13.0 22A380 darwin-x64, locale en-VN)
• Flutter version 3.6.0-3.0.pre.48 on channel master at /Users/huynq/Documents/GitHub/flutter_master
! Warning: `flutter` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
! Warning: `dart` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 93c4b09e62 (15 minutes ago), 2022-11-15 18:07:50 -0800
• Engine revision baad8f2c55
• Dart version 2.19.0 (build 2.19.0-403.0.dev)
• DevTools version 2.19.0
• If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/huynq/Library/Android/sdk
• Platform android-33, build-tools 31.0.0
• ANDROID_HOME = /Users/huynq/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14A400
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.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 11.0.13+0-b1751.21-8125866)
[✓] IntelliJ IDEA Community Edition (version 2022.2.2)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 70.0.5
• Dart plugin version 222.4167.21
[✓] IntelliJ IDEA Community Edition (version 2022.1.1)
• IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.app
• 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
[✓] VS Code (version 1.73.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.52.0
[✓] Connected device (3 available)
• RMX2001 (mobile) • EUYTFEUSQSRGDA6D • android-arm64 • Android 11 (API 30)
• macOS (desktop) • macos • darwin-x64 • macOS 13.0 22A380 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 107.0.5304.110
[✓] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 1 category.
|
Also, I can't reproduce the issue you raised at #115358 (comment). If you can reproduce it every time (the behavior is different from #108363), please file a new issue for that. Thanks! |
looks like a framework issue |
Are there any news on this issue? I have my tests failing due to the same problem (navigating with go_router). If not is there a way to configure the testing environment in such a way, that it ignores this exact error? The app works perfectly after all. |
Encountering the same issue.
Let me know if I can support testing a solution. |
Same problem form me.
Available to test a solution if anyone found anything. |
After an initial investigation, it looks like this is due to unexpected behavior where hero animation is dismissed on push. This is happening because Hero's animation is interrupted during multiple transitions and animation is dismissed on push |
Here I created a simpler code sample. When you have nested routes and you navigate the sub-root of the nested route. All the pages in between are built, which trigger hero animation and if the sub-root page doesn't have a hero widget, we get this crash message.
When I navigate to Log: flutter: Home
flutter: FirstPage
flutter: SubPage code sampleimport 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
void main() => runApp(const MyApp());
final GoRouter router = GoRouter(
routes: <RouteBase>[
GoRoute(
path: '/',
builder: (BuildContext context, GoRouterState state) => const Home(),
routes: <RouteBase>[
GoRoute(
path: 'first_page',
builder: (BuildContext context, GoRouterState state) => const FirstPage(),
routes: <RouteBase>[
GoRoute(
path: 'sub_page',
builder: (BuildContext context, GoRouterState state) =>
const SubPage(),
),
],
),
GoRoute(
path: 'second_page',
builder: (BuildContext context, GoRouterState state) =>
const SecondPage(),
),
],
),
],
);
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp.router(
debugShowCheckedModeBanner: false,
theme: ThemeData(useMaterial3: true),
routeInformationProvider: router.routeInformationProvider,
routeInformationParser: router.routeInformationParser,
routerDelegate: router.routerDelegate,
);
}
}
class Home extends StatelessWidget {
const Home({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Home'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
ElevatedButton(
onPressed: () => context.go('/first_page'),
child: const Text('Go to /first_page'),
),
ElevatedButton(
onPressed: () => context.go('/first_page/sub_page'),
child: const Text('Go to /first_page/sub_page'),
),
ElevatedButton(
onPressed: () => context.go('/second_page'),
child: const Text('Go to /second_page'),
),
],
),
),
floatingActionButton: FloatingActionButton(
heroTag: 'fab',
onPressed: () {},
child: const Icon(Icons.add),
),
);
}
}
class FirstPage extends StatelessWidget {
const FirstPage({
super.key,
});
@override
Widget build(BuildContext context) {
print('FirstPage');
return Scaffold(
appBar: AppBar(
title: const Text('First Page'),
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
floatingActionButton: FloatingActionButton(
heroTag: 'fab',
onPressed: () {},
child: const Icon(Icons.add),
),
);
}
}
class SecondPage extends StatelessWidget {
const SecondPage({
super.key,
});
@override
Widget build(BuildContext context) {
print('SecondPage');
return Scaffold(
appBar: AppBar(
title: const Text('Second Page'),
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
floatingActionButton: FloatingActionButton(
heroTag: 'fab',
onPressed: () {},
child: const Icon(Icons.add),
),
);
}
}
class SubPage extends StatelessWidget {
const SubPage({super.key});
@override
Widget build(BuildContext context) {
print('SubPage');
return Scaffold(
appBar: AppBar(
title: const Text('SubPage'),
),
);
}
} |
cc: @chunhtai |
@TahaTesser Any fix or workaround for this? |
None from me at the moment, this behavior isn't replicable for me without using
|
I think this is due to multiple route with the same hero are push onto the screen at the same time. This is a known issue, I am currently working on a refactor of HeroController to solve all these issue once and for all, the (WIP)design doc is here https://docs.google.com/document/d/17EG-Sgp7kHVetX-odJ5jrgnpBWj2lx097sYtrSP5xno/edit?resourcekey=0-B8Jaq82Z6qeCG6Re4qcH_Q |
Hi, is there any update on this issue? I just moved to go_router in one of my apps, and I'm getting this error all the time. |
I am still actively working on the design. Right now the latest proposal is frame driven hero |
I also have the same issue using go_router and scaffold with FAB. The issue occurs when pushing ModalBottomSheetRoute. |
Got the same issue here, but the problem was a Snackbar. Solved this by removing current Snackbar to avoid this issue. If you have problems with FABs, you could show a SizedBox instead of the FAB when a new route is pushed (as a workaround). bool _routePush = false;
/* somewhere in the code:
onTap(
() {
setState(() => _routePush = true));
context.go('/myRoute');
}
)
*/
_routePush ? SizedBox() : FloatingActionButton() |
Same problem to me , anyone fixed it ? |
This issue is assigned to @chunhtai but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks! |
I haven't had time to come back to this issue yet. I will reopen this #140675 when i got time |
Workaround that worked for me.
|
Steps to Reproduce
Expected results:
Expect opening page Register
Actual results:
_AssertionError ('package:flutter/src/widgets/heroes.dart': Failed assertion: line 651 pos 12 ... is not true.)
But, if remove all FABs on all pages - everything going fine: all buttons and navigation work properly.
Code sample
Logs
The text was updated successfully, but these errors were encountered: