1

I updated flutter stable version 2.2.1 (Nullable feature enabled). When I write constructor of the class as following code, I got error as following image shows. Please help me to resolve this. enter image description here

class FlavorBanner extends StatelessWidget {
  final Widget child ;
  late BannerConfig bannerConfig;
  FlavorBanner({@required this.child});

}
Malisha De Silva
  • 393
  • 2
  • 10

1 Answers1

1

Use the new keyword required instead of @required, which says the property is mandatory.

class FlavorBanner extends StatelessWidget {
  final Widget child;
  late BannerConfig bannerConfig;
  FlavorBanner({
    required this.child,
  });
}
quoci
  • 2,940
  • 1
  • 9
  • 21