{}
are missing to make them named parameters
const Category({
@required this.name,
@required this.icon,
@required this.color
}) : assert(name != null),
assert(icon != null),
assert(color != null);
or just remove @required
Without {}
they are positional parameters which are required anyway.
Category('foo', someIcon, Colors.white)
vs
Category(name: 'foo', icon: someIcon, color: Colors.white)
[]
makes them optional positional parameters.
Positional (non-optional) need to be declared first, optional parameters come at the end.
Optional positional and optional named parameters can not be used together.
Optional parameters (positional and named) can have default values
this.name = 'foo'
Default values need to be compile-time constants.