createFile static method

Future<bool> createFile(
  1. String? filePath
)

创建文件

Implementation

static Future<bool> createFile(String? filePath) async {
  if (filePath == null) {
    return false;
  }
  try {
    final file = File(filePath);
    if (!file.existsSync()) {
      file.createSync(recursive: true);
    }
    return true;
  } catch (err) {
    return false;
  }
}