Open
Description
Avoid type explicit type annotations when they can be inferred.
From the style guide:
If an invocation’s type argument list is correctly inferred with the types you want, then omit the types and let Dart do the work for you.
GOOD:
var strings = ['foo', 'bar', 'baz'];
var fakeSimStore = FakeStore(Sim());
var stars = Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.star, color: Colors.green[500]),
Icon(Icons.star, color: Colors.black),
],
);
BAD:
var strings = <String>['foo', 'bar', 'baz'];
var fakeSimStore = FakeStore<Sim>(Sim());
var stars = Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(Icons.star, color: Colors.green[500]),
Icon(Icons.star, color: Colors.black),
],
);
/cc @jefflim-google