pubspec 2.3.0 copy "pubspec: ^2.3.0" to clipboard
pubspec: ^2.3.0 copied to clipboard

A library for manipulating pubspec.yaml files

example/pubspec.dart

// Copyright (c) 2015, Anders Holmgren. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

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

main() async {
  // specify the directory
  var myDirectory = Directory('myDir');
  ;

  // load pubSpec
  var pubSpec = await PubSpec.load(myDirectory);

  // change the dependencies to a single path dependency on project 'foo'
  var newPubSpec = pubSpec.copy(dependencies: {'foo': PathReference('../foo')});

  // save it
  await newPubSpec.save(myDirectory);
}
17
likes
120
pub points
99%
popularity

Publisher

verified publishertheconduit.dev

A library for manipulating pubspec.yaml files

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

path, pub_semver, uri, yaml

More

Packages that depend on pubspec