magicList method

List magicList({
  1. List defaultValue = const [],
})

Converts the value to a List.

  • defaultValue: The value to return if the conversion fails or the value is null.

Implementation

List magicList({List defaultValue = const []}) {
  if (isNull) return defaultValue;
  if (this is List) return this as List;
  if (this is Set) return (this as Set).toList();
  if (this is Queue) return (this as Queue).toList();
  return [this];
}