properties
Dart में प्रॉपर्टी फ़ाइल (और कुछ अधिक) को प्रबंधित करने के लिए एक सरल पुस्तकालय
डार्ट में .properties फ़ाइल का प्रबंधन करें
यह अंग्रेज़ी मूल स्नैपशॉट है। नवीनतम सामग्री GitHub पर देखें।
Properties is a simple library to manage properties files (and something more) in Dart.
The project aim is to provide a simple and lightweight implementation of properties file management for Dart adding some useful but not so common features. Code and usage are very straightforward, just have a look at the Getting Started section below.
To know something more about the released version have a look at the CHANGELOG to find the version that works best for you.
The best way to get immediately started is to have a look at the unit tests provided along with the source code.
Anyway you can go on reading this quick intro.
Using Properties you can:
Properties p = Properties.fromFile(filepath);
String value = p.get('test.key.1');
..optionally providing a default value..
String defval = p.get('test.key.X', defval:'value X');
..or a default key..
String defkey = p.get('test.key.X', defkey:'test.key.1');
int anInt = p.getInt('test.key.integer');
double aDouble = p.getDouble('test.key.double');
bool aBool = p.getBool('test.key.bool');
List<String> list = p.getList('test.key.listofvalues');
bool added = p.add('test.key.3', 'value 3', true);
and then listen to "property added" or "property updated" events
p.onAdd.listen((AddEvent e) {
eventType = e.type;
key = e.key;
value = e.value;
});
String jsonexport = p.toJSON([prefix, suffix]);
Map<String,String> filtered = p.every((s) => s.startsWith('test'));
To run the tests just run the test/properties_test.dart file.
Output on file is not supported (yet!).