File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -27,18 +27,20 @@ class Loader {
2727
2828 /// The span of the entire stream emitted so far.
2929 FileSpan get span => _span;
30- late FileSpan _span;
30+ FileSpan _span;
3131
3232 /// Creates a loader that loads [source] .
3333 ///
3434 /// [sourceUrl] can be a String or a [Uri] .
35- Loader (String source, {sourceUrl})
36- : _parser = Parser (source, sourceUrl: sourceUrl) {
37- var event = _parser.parse ();
38- _span = event.span;
35+ factory Loader (String source, {sourceUrl}) {
36+ var parser = Parser (source, sourceUrl: sourceUrl);
37+ var event = parser.parse ();
3938 assert (event.type == EventType .streamStart);
39+ return Loader ._(parser, event.span);
4040 }
4141
42+ Loader ._(this ._parser, this ._span);
43+
4244 /// Loads the next document from the stream.
4345 ///
4446 /// If there are no more documents, returns `null` .
You can’t perform that action at this time.
0 commit comments