IList<T>.unsafe constructor

IList<T>.unsafe(
  1. List<T> list, {
  2. required ConfigList config,
})

Unsafe constructor. Use this at your own peril.

This constructor is fast, since it makes no defensive copies of the list. However, you should only use this with a new list you've created it yourself, when you are sure no external copies exist. If the original list is modified, it will break the IList and any other derived lists in unpredictable ways.

Note you can optionally disallow unsafe constructors (ImmutableCollection) in the global configuration by doing: ImmutableCollection.disallowUnsafeConstructors = true (and then optionally preventing further configuration changes by calling lockConfig()).

Implementation

factory IList.unsafe(List<T> list, {required ConfigList config}) =>
    IListImpl.unsafe(list, config: config);