getDartToolVaniaConfig function

Future<Map<String, dynamic>?> getDartToolVaniaConfig()

Implementation

Future<Map<String, dynamic>?> getDartToolVaniaConfig() async {
  final configFile = await getDartToolVaniaConfigFile();
  if (configFile != null) {
    String base = configFile.readAsStringSync();
    try {
      if (base == '') {
        Map<String, dynamic> config = {'lastRun': DateTime.now().toString()};
        configFile.writeAsString(jsonEncode(config));
        return config;
      }
      return jsonDecode(base);
    } catch (_) {}
  }
  return null;
}