onepub-dev / pubspec_manager

Eric lets you read, modify and write pubspec.yaml files whilst preserving comments and everything else.
MIT License
5 stars 3 forks source link

Request: a way for extended usage #9

Open Rodsevich opened 1 month ago

Rodsevich commented 1 month ago

What do you think about providing a way of facilitating custom usage of PubSpec with things currently not supported?

e.g.:

Suppose I want to programmatically add the classic

flutter:
  uses-material-design: true
  generate: true

at the end of pubspec.yaml I was thinking on how to do that and I stumbled upon 2 approaches:

the fancy way, through
Extension('flutter', {'uses-material-design': 'true', 'generate': 'true'})
or with access to the very string of the pubspec:
pubspec.load()..source.append('''flutter:
  uses-material-design: true
  generate: true
''')..save();

I think both will be nice to have in this package

bsutton commented 1 month ago

This is already available.

Have a look at the document class.

pubspec.document.

On Sat, 30 Mar 2024, 4:04 am Nico, @.***> wrote:

What do you think about providing a way of facilitating custom usage of pubspec with things currently not supported? I was thinking on how to do that and I think It can be the fancy way, through Extension('flutter', {'uses-material-design': 'true', 'generate': 'true') or with access to the very string of the pubspec:

pubspec.load()..source.append('''flutter: uses-material-design: true generate: true''')..save();

— Reply to this email directly, view it on GitHub https://github.com/onepub-dev/pubspec_manager/issues/9, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG32OHXFXSH7ONQFRFWDW3Y2WNIBAVCNFSM6AAAAABFOVTQVOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGIYTKNZQHAYTCNY . You are receiving this because you are subscribed to this thread.Message ID: @.***>