'prefer const with constant constructor

I have an error that shows this message "prefer const with constant constructor" when i deleting const on below class splashscreen theres not showing any error but throwing
heres my code

  const SplashScreen({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Stack(
        children: <Widget>[
          Container(
            child: Image.network(
                "https://cdn.kibrispdr.org/data/white-background-hd-0.jpg"),
          ),
          Container(
            padding: EdgeInsets.symmetric(horizontal: 50),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                Image.asset(
                  "name",
                  height: 50,
                ),
                SizedBox(
                  height: 18,
                ),
                Row(
                  children: <Widget>[
                    Text(
                      "Management",
                      style: TextStyle(
                          color: Colors.white,
                          fontSize: 15,
                          fontWeight: FontWeight.w800),
                    ),
                  ],
                ) //Image Asset untuk logo splashscreen
              ],
            ),
          )

can someone help with this error really appreciate your help.



Solution 1:[1]

This is not really an error, it's just an info message. This message comes from the flutter_lints package that tells you the recommended best practices.

You can learn more about const in Dart from here.

If you want to disable linting then go to the analysis_options.yaml file (present inside the root directory of your Flutter project) and comment out the line:

include: package:flutter_lints/flutter.yaml

But keep in mind this is not recommended.

Solution 2:[2]

To prefer const with constant constructors

Go to analaysis_options.yaml file in your Flutter project folder, then under rules title type Prefer_const_constructors: false Prefer_const_literals_to_create_immutables: false Then save it Tip: Type it not copy it

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Souvik Biswas
Solution 2 Jack