parse method
Parses the provided text
according to the matchers specified in
the constructor.
The result contains all the elements in text including the ones
not matching any pattern provided by matchers unless onlyMatches
is set to true
explicitly.
Parsing is executed in an isolate by default except on the web,
which dart:isolate does not support. It is for preventing the
impact of heavy computation on other processes, but it instead
adds some overhead and result in longer execution time. If you
prefer to use the main thread, set useIsolate
to 'false'.
Implementation
Future<List<TextElement>> parse(
String text, {
bool onlyMatches = false,
bool useIsolate = true,
}) async {
if (text.isEmpty) {
return [];
}
return useIsolate
? _parser.parseInIsolate(text, onlyMatches: onlyMatches)
: _parser.parseAsync(text, onlyMatches: onlyMatches);
}