Emir Bolat
Emir Bolat

Reputation: 1049

Flutter - _AssertionError ('package:flutter/src/widgets/framework.dart': Failed assertion: line 4937 pos 12: 'child == _child': is not true.) Error

I am getting an error like this:

════════ 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

It gives the error in this code:

  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      home: Scaffold(
        body: Column(

How can I solve this problem?

Upvotes: 2

Views: 4419

Answers (1)

Celt K. B.
Celt K. B.

Reputation: 789

You are certainly using GetMaterialApp more than one time.

if you have something like this:

void main() {
  runApp(
     const GetMaterialApp(
       debugShowCheckedModeBanner: false,
     home: MyApp(),
    )
  );
}

you should not use GetMaterialApp again in the build method. You should use the standard MaterialApp there.

Upvotes: 3

Related Questions