CompletionConfiguration.fromFile constructor
CompletionConfiguration.fromFile(
- File file
Creates a CompletionConfiguration from the given file
content.
If the file does not exist or is empty, a CompletionConfiguration.empty is created.
If the file is not empty, a CompletionConfiguration is created from the file's content. This content is assumed to be a JSON string. The parsing is handled gracefully, so if the JSON is partially or fully invalid, it handles issues without throwing an Exception.
Implementation
factory CompletionConfiguration.fromFile(File file) {
if (!file.existsSync()) {
return CompletionConfiguration.empty();
}
final json = file.readAsStringSync();
return CompletionConfiguration._fromJson(json);
}