IListConst<T> constructor

  1. @literal
const IListConst<T>(
  1. List<T> _list, [
  2. ConfigList config = const ConfigList()
])

To create an empty constant IList: const IListConst([]). To create a constant list with items: const IListConst([1, 2, 3]).

IMPORTANT: You must always use the const keyword. It's always wrong to use an IListConst which is not constant.

Implementation

@literal
const IListConst(this._list,
    // Note: The _list can't be optional. This doesn't work: [this._list = const []]
    // because when you do this _list will be List<Never> which is bad.
    [this.config = const ConfigList()])
    : super._gen();