import 'package:flutter/material.dart';
void main() {
runApp(
const MaterialApp(
home: Scaffold(
backgroundColor: Colors.yellowAccent,
appBar: AppBar(
title: Text('I am Rich'),
),
),
)
);
}
I’m starting to study a new course on Flutter and get a warning saying "The constructor being called is not a constructor" Can somebody tell me why is that? It only appears when I add the Text Widget… What’s wrong here? thank you in advance. I’m a total beginner
2
Answers
you should remove the
const
keyword in front of theMaterialApp
, becauseAppBar()
is not a const constructorYou should add const keyword before your Text Widget. Because you have added static text in Text Widget.