new(flutter): Initial Suport for NNBD (#554)

This commit is contained in:
Jagandeep Brar
2022-01-02 15:57:46 -05:00
committed by GitHub
parent 8abffca0a0
commit b012bbf5b0
1411 changed files with 17071 additions and 16280 deletions

View File

@@ -41,15 +41,15 @@ void main() {
});
}
void _writeFile(String path, Map<dynamic, dynamic> data) {
void _writeFile(String path, Map<dynamic, dynamic>? data) {
// Read the current data in the file
File file = File(path);
Map<dynamic, dynamic> fileData = jsonDecode(file.readAsStringSync());
Map<dynamic, dynamic>? fileData = jsonDecode(file.readAsStringSync());
// Ensure the file exists
if (file.existsSync()) {
print(' Appending localization strings...');
// Add all the localization strings to the file, and write back the string version of the map.
fileData.addAll(data);
fileData!.addAll(data!);
JsonEncoder encoder = const JsonEncoder.withIndent(' ');
file.writeAsStringSync(
encoder.convert(fileData),