createFile function

Future<void> createFile(
  1. dynamic filePath, {
  2. bool clear = false,
})

Implementation

Future<void> createFile(filePath, {bool clear=false}) async {
	var isExists = await File(filePath).exists();

	if(isExists == false){
		await File(filePath).create(recursive: true);
	} else {
		if(clear){
			await File(filePath).writeAsString('');
		}
	}
}