clear method
void
clear()
Clears all elements from the array. If the fields list is null, it initializes it before clearing. After calling this method, the array will be empty.
Implementation
void clear() {
fields ??= <T>[];
fields!.clear();
}