yaml_modify 0.1.3 copy "yaml_modify: ^0.1.3" to clipboard
yaml_modify: ^0.1.3 copied to clipboard

outdated

A library for modify yaml files, for example you can modify pubspec.yaml by this library

example/main.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.

library yaml_modify.example;

import 'dart:collection';
import 'dart:io' show File;

import 'package:yaml_modify/yaml_modify.dart';

main() {
  File file = File("pubspec.yaml");

  final yaml = loadYaml(file.readAsStringSync());

  final modifiable = getModifiableNode(yaml);
  modifiable.putIfAbsent('flutter', () => HashMap());
  modifiable['flutter']["assets"] = ['img1.png', 'img2.png'];


  final strYaml = toYamlString(modifiable);
  File("pubspec-output.yaml").writeAsStringSync(strYaml);
  print(strYaml);
}
6
likes
0
pub points
87%
popularity

Publisher

unverified uploader

A library for modify yaml files, for example you can modify pubspec.yaml by this library

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

quiver, yaml

More

Packages that depend on yaml_modify