Tuple2<T1, T2>.fromList constructor Null safety

Tuple2<T1, T2>.fromList(
  1. List items
)

Create a new tuple value with the specified list items.

Implementation

factory Tuple2.fromList(List items) {
  if (items.length != 2) {
    throw ArgumentError('items must have length 2');
  }

  return Tuple2<T1, T2>(items[0] as T1, items[1] as T2);
}