搜索插件、代码仓与 APP 分类

GitHub 代码仓matthewnitschke/pubspec_lock_parse

pubspec_lock_parse

用于解析 pubspec.lock 文件的简单包,具有类型安全的 API 和丰富的错误报告。

pubspec_lock_parse 项目封面
星标
5
复刻
2
最近推送(UTC)
2022年10月15日
项目状态
未归档

原始 README

以下为英文项目原文快照,最新内容请访问 GitHub。

Dart pub package

Supports parsing pubspec.lock files with robust error reporting

Designed around the pubspec_parse package, and mirrors its implementation and interface

Usage

import 'dart:io';
import 'package:pubspec_lock_parse/pubspec_lock_parse.dart';

void main() {
    final lockStr = File('path/to/pubspec.lock').readAsStringSync();
    final lockfile = PubspecLock.parse(lockStr);
}

You can find more about the PubspecLock object in the documentation here

toJson() methods

pubspec_lock_parse includes .toJson() methods on each object to allow for easy re-generation/mutation of pubspec files

This can be combined with yaml_writer to re-generate yaml output

void main() {
    final pubspec = PubspecLock(
        packages: {
            'somePackage': Package(
                dependency: 'transitive',
                description: PathPackageDescription(
                    path: '../somePackage',
                    relative: true,
                )
            )
        },
        sdks: {
            'dart': VersionConstraint.parse(">=2.17.0 <3.0.0"),
        }
    );

    final jsonPubspec = pubspec.toJson(); // outputs Map<String, dynamic>
    final yamlPubspec = YamlWriter().write(jsonPubspec); // outputs String
}

toJson can also be run on any individual object

// outputs: { path: '../somePackage', relative: true }
print(PathPackageDescription(
    path: '../somePackage',
    relative: true,
).toJson());
Matthew GitHub avatar
GitHub 作者

Matthew ↗

Dedicated to overengineering solutions to problems no one has

Bozeman, MT官方网站 ↗
语言Dart

此仓库发布的插件

使用的依赖

依赖清单 9 项

如何选择适合项目的代码仓?

先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。

  1. 通过仓库名、作者或描述搜索,再按技术分类缩小范围。
  2. 结合星标、复刻与最近推送比较项目;星标反映社区关注,不代表质量保证。
  3. 使用前在 GitHub 核对 README、许可证与 Issues。

来源与维护

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗