[英]Unhandled Exception: 'package:flutter/src/widgets/framework.dart': Failed assertion: '_debugCurrentBuildTarget == context': is not true
[英]Flutter - _AssertionError ('package:flutter/src/widgets/framework.dart': Failed assertion: line 4937 pos 12: 'child == _child': is not true.) Error
我收到這樣的錯誤:
════════ Exception caught by widgets library ═══════════════════════════════════
The following assertion was thrown building Builder(dependencies: [MediaQuery]):
'package:flutter/src/widgets/framework.dart': Failed assertion: line 4937 pos 12: 'child == _child': is not true.
package:flutter/…/widgets/framework.dart:4937
2
Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=2_bug.md
The relevant error-causing widget was
GetMaterialApp
它在此代碼中給出了錯誤:
@override
Widget build(BuildContext context) {
return GetMaterialApp(
home: Scaffold(
body: Column(
我怎么解決這個問題?
您肯定不止一次使用GetMaterialApp 。
如果你有這樣的事情:
void main() {
runApp(
const GetMaterialApp(
debugShowCheckedModeBanner: false,
home: MyApp(),
)
);
}
您不應在構建方法中再次使用GetMaterialApp 。 您應該在那里使用標准的MaterialApp 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.