shift<T> method

T shift<T>(
  1. List<T> l
)

Remove and return the first element from a list.

Implementation

T shift<T>(List<T> l) {
  if (l.isNotEmpty) {
    final T first = l.first;
    l.removeAt(0);
    return first;
  }
  return null as T;
}