Skip to content
Merged
Prev Previous commit
Next Next commit
openFile now returns null when no files are selected, following the API.
  • Loading branch information
ditman committed Jul 12, 2023
commit 9ebad61b3700e59ae53eeba754b63eb2c7c328b8
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ class FileSelectorWeb extends FileSelectorPlatform {
}

@override
Future<XFile> openFile({
Future<XFile?> openFile({
List<XTypeGroup>? acceptedTypeGroups,
String? initialDirectory,
String? confirmButtonText,
}) async {
final List<XFile> files =
await _openFiles(acceptedTypeGroups: acceptedTypeGroups);
return files.first;
return files.isNotEmpty ? files.first : null;
}

@override
Expand Down