UpperCamelCase.
snake_case(lowercase_with_underscores).
lowerCamelCase.
var
when possible.=>
(arrow) notation is used for expression functions.+
to build a string out of literals and other values. That does work in Dart, but itโs almost always cleaner and shorter to use interpolation:{}
should be omitted.new
Dart 2 makes thenew
keyword optional. Even in Dart 1, its meaning was never clear because factory constructors mean anew
invocation may still not actually return a new object.The language still permitsnew
in order to make migration less painful, but consider it deprecated and remove it from your code.
if
condition instead of conditional expressionEventItem
is a separate widget that will load individual events. EventItem
is usually stored in a separate file.const
include Text
, Padding
, and Icons
, to mention a few. If the widgets contain dynamic information, they shouldnโt be declared as constants.flutter analyze
in your terminal to check your code. This tool is a wrapper around the dartanalyzer tool. It performs static analysis of your code.flutter logs
. The console will also include additional information such as the stack trace for the exception.