Stop using the List constructor (#71957)
This commit is contained in:
parent
d1f78b48ea
commit
a109fe68b0
@ -19,7 +19,7 @@ class HeavyWidget extends StatelessWidget {
|
||||
HeavyWidget(this.index) : super(key: ValueKey<int>(index));
|
||||
|
||||
final int index;
|
||||
final List<int> _weight = List<int>(1000000);
|
||||
final List<int> _weight = List<int>.filled(1000000, null);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -77,7 +77,7 @@ class PathAnimation {
|
||||
final List<PathCommandAnimation> commands = <PathCommandAnimation>[];
|
||||
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<List<Point<double>>> points = List<List<Point<double>>>(numPointsInCommand);
|
||||
final List<List<Point<double>>> points = List<List<Point<double>>>.filled(numPointsInCommand, null);
|
||||
for (int j = 0; j < numPointsInCommand; j += 1)
|
||||
points[j] = <Point<double>>[];
|
||||
final String commandType = frames[0].paths[pathIdx].commands[commandIdx].type;
|
||||
@ -422,7 +422,7 @@ class SvgPathCommandBuilder {
|
||||
}
|
||||
|
||||
List<double> _pointsToVector3Array(List<Point<double>> points) {
|
||||
final List<double> result = List<double>(points.length * 3);
|
||||
final List<double> result = List<double>.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<double> _pointsToVector3Array(List<Point<double>> points) {
|
||||
|
||||
List<Point<double>> _vector3ArrayToPoints(List<double> vector) {
|
||||
final int numPoints = (vector.length / 3).floor();
|
||||
final List<Point<double>> points = List<Point<double>>(numPoints);
|
||||
final List<Point<double>> points = List<Point<double>>.filled(numPoints, null);
|
||||
for (int i = 0; i < numPoints; i += 1) {
|
||||
points[i] = Point<double>(vector[i*3], vector[i*3 + 1]);
|
||||
}
|
||||
|
@ -178,14 +178,14 @@ class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final List<AnimationController> controllers = List<AnimationController>(IMAGES);
|
||||
final List<AnimationController> controllers = List<AnimationController>.filled(IMAGES, null);
|
||||
for (int i = 0; i < IMAGES; i++) {
|
||||
controllers[i] = AnimationController(
|
||||
duration: const Duration(milliseconds: 3600),
|
||||
vsync: this,
|
||||
)..repeat();
|
||||
}
|
||||
final List<Completer<bool>> completers = List<Completer<bool>>(IMAGES);
|
||||
final List<Completer<bool>> completers = List<Completer<bool>>.filled(IMAGES, null);
|
||||
for (int i = 0; i < IMAGES; i++) {
|
||||
completers[i] = Completer<bool>();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user