Default value

In JavaScript, uninitialized variables are undefined.

In Dart, uninitialized variables have an initial value of null.
Because numbers are objects in Dart, even uninitialized variables with
numeric types have the value null.

Note:
  As of 2.12, Dart supports Sound Null Safety,
  all underlying types are non-nullable by default,
  which must be initialized as a non-nullable value.

// JavaScript

var

name

// == undefined

Try it out in DartPad.

For more information, see the documentation on
variables.

Checking for null or zero

In JavaScript, values of 1 or any non-null objects
are treated as true when using the == comparison operator.

// JavaScript

var

myNull

null

if

myNull