static Iterable parse()

in lib/src/pkg_resolution.dart [331:370]


  static Iterable<PubEntry> parse(String input) sync* {
    String? header;
    List<String>? entryLines;

    for (var line in LineSplitter.split(input)) {
      if (line.trim().isEmpty) {
        continue;
      }
      var match = _headerMatch.firstMatch(line);

      if (match != null) {
        if (header != null || entryLines != null) {
          assert(entryLines!.isNotEmpty);
          yield PubEntry(header!, entryLines!);
          header = null;
          entryLines = null;
        }
        header = match[1];
        entryLines = <String>[match[2]!];
      } else {
        match = _lineMatch.firstMatch(line);

        if (match == null) {
          // Likely due to Flutter silly
          // log.severe("Could not parse pub line `$line`.");
          continue;
        }

        assert(entryLines != null);
        entryLines!.add(match[1]!);
      }
    }

    if (header != null || entryLines != null) {
      assert(entryLines!.isNotEmpty);
      yield PubEntry(header!, entryLines!);
      header = null;
      entryLines = null;
    }
  }