FilePickerCross class
FilePickerCross allows you to select files on any of Flutters platforms.
Constructors
- FilePickerCross(Uint8List _bytes, {String? path, FileTypeCross type = FileTypeCross.any, String fileExtension = ''})
Properties
- directory → String
-
Returns the directory the file is located in. This it typically everything before the last
/
or\
. Note: Even on Windows and web platforms, where file paths are typically presented using\
instead of/
, the path's single directories are separated using/
.no setter - fileExtension → String
-
The allowed file extension of the file to be selected
final
- fileName → String?
-
Returns the name of the file. This typically is the part of the path after the last
/
or\
.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- length → int
-
Returns the file's length in bytes
no setter
- path → String?
-
Returns the path the file is located at
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- type → FileTypeCross
-
The allowed FileTypeCross of the file to be selected
final
Methods
-
exportToStorage(
{String? subject, String? text, String? fileName, }) → Future< String?> - Export the file to the external storage. This shows a file dialog allowing to select the file name and location and will return the finally selected, absolute path to the file.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
saveToPath(
{required String path}) → Future< bool> -
Save the file to an internal path.
This does not allow you to save the file to the device's public storage like
Documents
,Downloads
orPhotos
but saves the FilePickerCross in an app specific, internal folder for later access by this app only. To export a file to the local storage, use exportToStorage instead. -
toBase64(
) → String - Returns the file as base64-encoded String.
-
toMultipartFile(
{String? filename}) → MultipartFile - Returns the file as MultiPartFile for use with tha http package. Useful for file upload in apps.
-
toString(
) → String -
Returns a sting containing the file contents of plain text files. Please use it in a try {} catch (e) {} block if you are unsure if the opened file is plain text.
override
-
toUint8List(
) → Uint8List - Returns the file as a list of bytes.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
delete(
{required String path}) → Future< bool> - finally deletes a file stored in the given path of your application's fake filesystem
-
fromInternalPath(
{required String path}) → Future< FilePickerCross> -
Creates a
FilePickerCross
from a local path. This does not allow you to open a file from the local storage but only a file previously saved by saveToPath. If you want to open the file to the shared, local memory, use importFromStorage instead. -
importFromStorage(
{FileTypeCross type = FileTypeCross.any, String fileExtension = ''}) → Future< FilePickerCross> -
Shows a dialog for selecting a file from your device's internal storage.
If thee selected file is a Null byte, a
NullThrownError
is thrown. If the file selection was canceled by the user, a FileSelectionCanceledError is thrown. -
importMultipleFromStorage(
{FileTypeCross type = FileTypeCross.any, String fileExtension = ''}) → Future< List< FilePickerCross> > - Imports multiple files into your application. See importFromStorage for further details.
-
listInternalFiles(
{Pattern? at, Pattern? name}) → Future< List< String> > - Lists all internal files inside the app's internal memory
-
pick(
{FileTypeCross type = FileTypeCross.any, String fileExtension = ''}) → Future< FilePickerCross> - Deprecated. Use importFromStorage instead
-
quota(
) → Future< FileQuotaCross> - returns the maximally available storage space
-
save(
{FileTypeCross type = FileTypeCross.any, String fileExtension = ''}) → Future< FilePickerCross> - Deprecated. Use saveToPath or exportToStorage instead.