toTypedList<T> function
PIComposer APIPIComposer API

toTypedList<T>#

Option<List<T>> toTypedList<T>(dynamic value)

Converts a dynamic value to a typed list of T, if possible.

Returns Some(List<T>) if the value is a list containing only elements of type T, or None if the conversion fails (value is not a list or contains incompatible types).

Example:

final result = toTypedList<int>([1, 2, 3]); // Some([1, 2, 3])
final failure = toTypedList<int>([1, '2', 3]); // None