Upgrading file_picker 12 to 13
Breaking12.3.0 → 13.3.1Breaking2Platform1Deprecated1Changed2Fixed1Other1
Fetching 5 releases from GitHub…4 / 5
BreakingUpgrade verdict
2 breaking changes and a platform requirement change.
In plain terms
- Several old options have been removed. Use the newer replacements instead: pickFile() for one file, readAsBytes()/readAsByteStream() for file data, and the platform-specific options objects.
- When you ask a picked file for its size, you can now get 'unknown' instead of a misleading zero. An empty file still reports 0.
- On iOS, the plugin now works with apps that use the newer UIScene app lifecycle.
- Two options on the save-file function are being retired because they never actually did anything. They still work for now but will be removed in the next major version.
Must act 4 items need code or config changes
What you must change
Breaking2
Removes parameters deprecated since the 12.0.0 federated rewrite, including allowMultiple, withData, withReadStream, readSequential, lockParentWindow, cancelUploadOnWindowBlur and androidSafOptions.
pickFiles()pickFile()getDirectoryPath()saveFile()allowMultiplewithDatawithReadStreamreadSequentialPlatformFile.length() now returns Future<int?> instead of Future<int>, matching lengthSync(); null means the length could not be determined.
PlatformFile.length()PlatformFile.lengthSync()Platform1
Adds support for UIScene on iOS.
UISceneDeprecations to plan for
Deprecated1
Deprecates the
type and allowedExtensions parameters of FilePicker.saveFile(), which never had any effect; they will be removed in 14.0.0.FilePicker.saveFile()typeallowedExtensionsAPI changes
Generated by DepDelta from published Dart source. Not mixed with prose notes.
- changed:
static method FilePicker.getDirectoryPath({ String? dialogTitle, @Deprecated( 'Use WindowsOptions.lockParentWindow or LinuxOptions.lockParentWindow instead; this parameter will be removed in a future release.', ) bool lockParentWindow = …, String? initialDirectory, @Deprecated('Use androidOptions instead.') Object? androidSafOptions, AndroidOptions androidOptions = …, WindowsOptions windowsOption… → static method FilePicker.getDirectoryPath({ String? dialogTitle, String? initialDirectory, AndroidOptions androidOptions = …, WindowsOptions windowsOptions = …, LinuxOptions linuxOptions = …, WebOptions webOptions = …, }): Future<String?> - changed:
static method FilePicker.pickFile({ String? dialogTitle, String? initialDirectory, FileType type = …, List<String>? allowedExtensions, Function(FilePickerStatus)? onFileLoading, int compressionQuality = …, @Deprecated( 'Use WindowsOptions.lockParentWindow or LinuxOptions.lockParentWindow instead; this parameter will be removed in a future release.', ) bool lockParentWindow = …, @Deprecated( 'Use… → static method FilePicker.pickFile({ String? dialogTitle, String? initialDirectory, FileType type = …, List<String>? allowedExtensions, Function(FilePickerStatus)? onFileLoading, int compressionQuality = …, AndroidOptions androidOptions = …, DarwinOptions darwinOptions = …, WindowsOptions windowsOptions = …, LinuxOptions linuxOptions = …, WebOptions webOptions = …, }): Future<PlatformFile?> - changed:
static method FilePicker.pickFiles({ String? dialogTitle, String? initialDirectory, FileType type = …, List<String>? allowedExtensions, Function(FilePickerStatus)? onFileLoading, int compressionQuality = …, @Deprecated( 'use pickFile for single-file selection; this parameter will be removed in a future release', ) bool allowMultiple = …, @Deprecated( 'Use PlatformFile.readAsBytes(); this paramete… → static method FilePicker.pickFiles({ String? dialogTitle, String? initialDirectory, FileType type = …, List<String>? allowedExtensions, Function(FilePickerStatus)? onFileLoading, int compressionQuality = …, AndroidOptions androidOptions = …, DarwinOptions darwinOptions = …, WindowsOptions windowsOptions = …, LinuxOptions linuxOptions = …, WebOptions webOptions = …, }): Future<List<PlatformFile>> - changed:
static method FilePicker.saveFile({ required String fileName, required Uint8List bytes, String mimeType = …, String? dialogTitle, String? initialDirectory, FileType type = …, List<String>? allowedExtensions, Function(FilePickerStatus)? onFileSaving, @Deprecated( 'Use WindowsOptions.lockParentWindow or LinuxOptions.lockParentWindow instead; this parameter will be removed in a future release.', ) b… → static method FilePicker.saveFile({ required String fileName, required Uint8List bytes, String mimeType = …, String? dialogTitle, String? initialDirectory, @Deprecated( 'Has no effect, saveFile() never used it. ' 'This parameter will be removed in file_picker v14.0.0.', ) FileType type = …, @Deprecated( 'Has no effect, saveFile() never used it. ' 'This parameter will be removed in file_picker v14…
- added:
class FilePickerViewScope extends StatelessWidget - added:
ctor FilePickerViewScope({super.key, required this.child}) - added:
field FilePickerViewScope.child: final Widget - added:
method FilePickerViewScope.build(BuildContext context): Widget - added:
static method FilePickerViewScope.of(BuildContext context): FilePickerPlatform