init method

  1. @override
Future<void> init()

Ensure that files and directories that are expected to be present actually exist on the system. If not, create them.

Implementation

@override
Future<void> init() async {
  final appDir = await getApplicationDocumentsDirectory();
  outputDir = await Directory("${appDir.path}/Dashboard").create();
  loggingDir = await Directory("${outputDir.path}/logs/${DateTime.now().timeStamp}").create(recursive: true);
  if (!settingsFile.existsSync()) await writeSettings(null);
  dataLogger = Timer.periodic(const Duration(seconds: 5), logAllData);
  _isInit = true;
}