Quick Tips

How to validate pubspec.yaml file?

Please use an online yaml format validator, like http://www.yamllint.com/

How to remove the Debug banner?

Please add the debugShowCheckedModeBanner: false expression on the MaterialApp widget.

MaterialApp(
  debugShowCheckedModeBanner: false,
)

How to normalize date / time as text?

From a specific DateTime:

    DateTime now = new DateTime.now();

Approach 1:

String convertedDateTime = "${now.year.toString()}-${now.month.toString().padLeft(2,'0')}-${now.day.toString().padLeft(2,'0')} ${now.hour.toString()}-${now.minute.toString()}";
//result: 9999-99-99 format

Approach 2:

String convertedDateTime = now.toString().substring(0,10);
//result: 9999-99-99 format

How to remove the double underline in yellow on Text Widget?

Approach 1: To apply a theme to your Text Widget

 Text(
      'Your text',
       style: Theme.of(context).textTheme.bodyText1,
     )

Approach 2: To have your code inside a Scaffold Widget as it already defines a default theme.

MaterialApp(
      home: Scaffold(
        body: SomeWidget(
          child: Text(
                      'Your text',
                      style: TextStyle(fontSize: 20),
                    ),
                  ),
              ),
       )
Create your website with WordPress.com
Get started
%d bloggers like this: