Skip to content

Files

Latest commit

 

History

History
32 lines (23 loc) · 634 Bytes

always_require_non_null_named_parameters.md

File metadata and controls

32 lines (23 loc) · 634 Bytes

Pattern: Missing @required for non-null named parameter

Issue: -

Description

DO specify @required on named parameters without a default value on which an assert(param != null) is done.

Example of correct code:

m1({@required a}) {
 assert(a != null);
}

m2({a: 1}) {
 assert(a != null);
}

Example of incorrect code:

m1({a}) {
 assert(a != null);
}

NOTE: Only asserts at the start of the bodies will be taken into account.

Further Reading