toUint8List function

Uint8List toUint8List(
  1. List<int> input
)

Converts input into a Uint8List.

If input is a TypedData, this just returns a view on input.

Implementation

Uint8List toUint8List(List<int> input) {
  if (input is Uint8List) return input;
  if (input is TypedData) {
    // TODO(nweiz): remove "as" when issue 11080 is fixed.
    return Uint8List.view((input as TypedData).buffer);
  }
  return Uint8List.fromList(input);
}