fromDirectory static method

DirectoryFiles fromDirectory(
  1. Directory directory, {
  2. bool includePaths = false,
  3. String? relativeTo,
  4. RegExp? regex,
})

static method to create and return DirectoryFiles. It takes following argument:

  • Directory - Directory object containg the reference to the directory that you want to store as a reference. By default, it will save all the files in the directory to the cloud.
  • includePath - This is used to let framework know whether your want include the path of the directory also while saving it in cloud server or only the contents of the files inside the directory. true mean that you are willing to store the path and false is an indicator to only store content. By default, it is false and is optionl argument.
  • relativeTo - If you have shared the relative path of the directory and you want to store parent path/relative path. You can do this by adding the path here. This optional.
  • regex - RegExp to filter specific files satisfying specific pattern that needs to be stored in the cloud for reference

Example:

final directory = Directory('path-to-directory');
final directoryObject = FileDataObject.fromDirectory(directory);

Implementation

static DirectoryFiles fromDirectory(Directory directory,
    {bool includePaths = false, String? relativeTo, RegExp? regex}) {
  return DirectoryFiles(directory,
      includePaths: includePaths, relativeTo: relativeTo, regex: regex);
}