diff --git a/dev/benchmarks/macrobenchmarks/lib/src/heavy_grid_view.dart b/dev/benchmarks/macrobenchmarks/lib/src/heavy_grid_view.dart index bbe90e897b..af7a7dba09 100644 --- a/dev/benchmarks/macrobenchmarks/lib/src/heavy_grid_view.dart +++ b/dev/benchmarks/macrobenchmarks/lib/src/heavy_grid_view.dart @@ -19,7 +19,7 @@ class HeavyWidget extends StatelessWidget { HeavyWidget(this.index) : super(key: ValueKey(index)); final int index; - final List _weight = List(1000000); + final List _weight = List.filled(1000000, null); @override Widget build(BuildContext context) { diff --git a/dev/tools/vitool/lib/vitool.dart b/dev/tools/vitool/lib/vitool.dart index e445a98257..30c3329573 100644 --- a/dev/tools/vitool/lib/vitool.dart +++ b/dev/tools/vitool/lib/vitool.dart @@ -77,7 +77,7 @@ class PathAnimation { final List commands = []; for (int commandIdx = 0; commandIdx < frames[0].paths[pathIdx].commands.length; commandIdx += 1) { final int numPointsInCommand = frames[0].paths[pathIdx].commands[commandIdx].points.length; - final List>> points = List>>(numPointsInCommand); + final List>> points = List>>.filled(numPointsInCommand, null); for (int j = 0; j < numPointsInCommand; j += 1) points[j] = >[]; final String commandType = frames[0].paths[pathIdx].commands[commandIdx].type; @@ -422,7 +422,7 @@ class SvgPathCommandBuilder { } List _pointsToVector3Array(List> points) { - final List result = List(points.length * 3); + final List result = List.filled(points.length * 3, null); for (int i = 0; i < points.length; i += 1) { result[i * 3] = points[i].x; result[i * 3 + 1] = points[i].y; @@ -433,7 +433,7 @@ List _pointsToVector3Array(List> points) { List> _vector3ArrayToPoints(List vector) { final int numPoints = (vector.length / 3).floor(); - final List> points = List>(numPoints); + final List> points = List>.filled(numPoints, null); for (int i = 0; i < numPoints; i += 1) { points[i] = Point(vector[i*3], vector[i*3 + 1]); } diff --git a/examples/image_list/lib/main.dart b/examples/image_list/lib/main.dart index 83c524c63a..8f54d6a91c 100644 --- a/examples/image_list/lib/main.dart +++ b/examples/image_list/lib/main.dart @@ -178,14 +178,14 @@ class _MyHomePageState extends State with TickerProviderStateMixin { @override Widget build(BuildContext context) { - final List controllers = List(IMAGES); + final List controllers = List.filled(IMAGES, null); for (int i = 0; i < IMAGES; i++) { controllers[i] = AnimationController( duration: const Duration(milliseconds: 3600), vsync: this, )..repeat(); } - final List> completers = List>(IMAGES); + final List> completers = List>.filled(IMAGES, null); for (int i = 0; i < IMAGES; i++) { completers[i] = Completer(); }