Spec-Zone.ru › Dart 2

dart:core

List<E>.empty constructor

  1. @Since("2.9")
List<E>.empty(
  1. {bool growable = false}
)

Creates a new empty list.

If growable is false, which is the default, the list is a fixed-length list of length zero. If growable is true, the list is growable and equivalent to <E>[].

final growableList = List.empty(growable: true); // []
growableList.add(1); // [1]

final fixedLengthList = List.empty(growable: false);
fixedLengthList.add(1); // error

Implementation

@Since("2.9")
external factory List.empty({bool growable = false});

© 2012 the Dart project authors
Licensed under the BSD 3-Clause "New" or "Revised" License.
https://api.dart.dev/stable/2.19.6/dart-core/List/List.empty.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API