FileUtil class

Constructors

FileUtil()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

deleteEmptyDirectories(Directory dir) Future<void>
递归删除空目录
insertAfterMap(String content, String mapIdentifier, String insertContent, {bool afterClosingBrace = false}) String
在 Dart/Flutter 代码中,在特定的 map 对象下方插入内容(支持嵌套花括号) content - 原始文本内容 mapIdentifier - 要匹配的 map 对象标识符(如变量名或属性名) insertContent - 要插入的内容 afterClosingBrace - 是否在闭合花括号后插入(默认为 false)
insertBeforeLineInContent(String content, String targetLine, String insertionContent) String
在文本内容中查找特定行并在其前面插入内容 返回修改后的文本内容,如果未找到目标行则返回原内容
readFileContent(String filePath) String
读取文本内容并检查是否存在
removeLineByString(String content, String targetString) String
删除文本中包含指定字符串的第一行 content - 总内容 targetString - 目标字符串
replaceAttribute(String content, String attribute, String newContent) String
替换前面是特定内容,然后=不固定内容的情况 例如:namespace = "com.hambit.equipment",android:label="xxxxx"