size method

Future<int> size()

Returns the size of the file in bytes.

This is a shorthand for calling length(), and can be used to check whether the file is empty, too large, or within an acceptable limit before upload or processing.

Example:

final fileSize = await file.size();
print('File size: $fileSize bytes');

Throws a FileSystemException if the file does not exist or is inaccessible.

Implementation

Future<int> size() => length();