fromFile static method
static method to create and return FileObject. It takes following argument:
file
- The File object containing the reference of dataincludePath
- This is used to let framework know whether your want include the path of the file also while saving it in cloud server or only the content.true
mean that you are willing to store the path and false is an indicator to only store content. By default, it isfalse
and is optional argument.relativeTo
- If you have shared the relative path to create the file object and you want to store parent path/relative path. You can do this by adding the path here. This optional.
Example:
final packageFile = File('path-to-your-file');
fianl packageFileObject = FileDataObject.fromFile(packageFile)
Implementation
static FileObject fromFile(File file,
{bool includePath = false, String? relativeTo}) {
return FileObject(file, includePath: includePath, relativeTo: relativeTo);
}