ParameterizedSource.csv constructor
Creates a ParameterizedSource from supplied list of csv values (strings).
Csv values are split based on the supplied pattern
. By default pattern
is ','.
After splitting the values the library try to parse each value to the following types: int, double, bool or nullable string. If parsing is unsuccessful the initial string value is returned.
For example:
ParameterizedSource.csv([
'kiwi, 4'
'apple, 5'
'banana, 6'
]);
Implementation
factory ParameterizedSource.csv(List<String> csvValues,
{String pattern = ','}) =>
ParameterizedSource._(csvValues
.map(
(value) => value.split(pattern).map((e) => _tryParse(e)).toList())
.toList());