pubspec_writer_extensions 1.0.0 pubspec_writer_extensions: ^1.0.0 copied to clipboard
Extension methods for writing pubspec_parse's back to data formats
Pubspec Writer Extensions #
Extension methods, for the official pubspec_parse
objects, that facilitate writing the objects back to data formats.
Usage #
import 'package:pubspec_parse/pubspec_parse.dart';
import 'package:pubspec_writer_extensions/pubspec_writer_extensions.dart';
void main() {
final pubspec = Pubspec.parse(someYaml);
print(pubspec.toJson()); // outputs Map<String, dynamic>
}
this can be used in conjunction with yaml_writer
to write with yaml output:
import 'package:pubspec_parse/pubspec_parse.dart';
import 'package:pubspec_writer_extensions/pubspec_writer_extensions.dart';
import 'package:yaml_writer/yaml_writer.dart';
void main() {
final pubspec = Pubspec.parse(someYaml);
final yamlWriter = YAMLWriter();
print(yamlWriter.write(pubspec.toJson()));
}