exportJson method
Export to json files for LanguageDataProvider
. Default path
is set to './assets/resources'.
We need a little trick to run this script to get the expected result:
- Create a
export_json.dart
file in yourbin
folder (the same level with thelib
). - Add the below code:
void main() {
test('', () {
languageData.exportJson('./assets/resources');
});
}
- Add the missed
import
. - Run
flutter test ./bin/export_json.dart
.
Generated path:
path
| |- language_helper
| | |- codes.json
| | | |- languages
| | | | |- en.json
| | | | |- vi.json
| | | | |- ...
Implementation
void exportJson([String path = './assets/resources']) {
return s.exportJson(this, path);
}