fromString method
Creates an enumerable from a String
.
Converts a String into its character components and creates an enumerable
out of the resulting collection. (As String
doesn't extend Iterable
,
this is a convenience method to iterate over every character in the String
as well as make it compatable with other enumerable methods.)
Optionally takes a boolean useCache
value. If true
, the returned
enumerable will contain a buffer with the calculated string values.
Otherwise, the enumerable will calculate the string values every time it is
iterated. (useCache
defaults to false
.)
Implementation
static Enumerable<String> fromString(String s, {bool useCache = false}) {
ArgumentError.checkNotNull(s);
if (useCache) return StringEnumerable.withCache(s);
return StringEnumerable(s);
}