toJson method
- string rootUrlPath = "",
Return the details of a File or Directory as a Json
Implementation
Future<JsonMap> toJson({string rootUrlPath = ""}) async {
return {
"index": index,
"title": title,
"name": name,
"fullName": this.path,
if (rootUrlPath.isNotBlank) "url": url(rootUrlPath).toString(),
"size": size,
"shortSize": shortSize,
"typeDescription": typeDescription,
if (this is File) "Mime": (this as File).mimeType,
"relativePath": relativePath,
if (this is File) "md5CheckSum": await (this as File).md5Checksum,
if (this is Directory) "count": (this as Directory).count,
if (this is Directory) "children": [for (var e in (this as Directory).listSync()) await e.toJson(rootUrlPath: rootUrlPath + e.relativePathFrom(e.parent.path))],
};
}