Is that Flutter need required and late for null safety in sdk version up to 2.7.0?

217

change your code to:

  final CameraController _controller;
  final Future<void> _initializeControllerFuture;  

...

  const DisplayPictureScreen({Key key, @required this.imagePath})
      : super(key: key);
Share:
217
Druwa
Author by

Druwa

Updated on December 13, 2022

Comments

  • Druwa
    Druwa over 1 year

    In the below code, this code occurs error that late and required are not available in the flutter version 2.7.0.

      late CameraController _controller;
      late Future<void> _initializeControllerFuture;  
    
    ...
    
      const DisplayPictureScreen({Key? key, required this.imagePath})
          : super(key: key);
    

    So, I change the flutter version up to 2.1.2 like this, and solved this problem right away.

    environment:
      sdk: ">=2.12.0 <3.0.0"
    

    Is that Flutter need other definition instead of required and late for null safety in sdk version up to 2.7.0?

    If yes, how I changes definition required and late in sdk version up to 2.7.0?