Skip to content

[file_selector] Throw argument errors for XTypeGroup/platform mismatches #107469

@stuartmorgan-g

Description

@stuartmorgan-g

Currently in many (maybe all) of our file_selector implementations, we are identifying a wildcard type group by whether any of the fields that a platform supports are non-empty. This will silently cause likely-unexpected behavior on some platforms. E.g., if an XTypeGroup specifying only a text/plain MIME type is run on macOS or Windows, it will be treated as a wildcard, because neither platform currently supports MIME type filtering.

We should make a set of breaking changes (one to each implementation, then one to the app-facing package to pick them all up) that instead throws an ArgumentError if a platform receives an XTypeGroup that isn't a wildcard, but doesn't set any filters supported by the platform. Then it'll be a clear error, instead of silently doing something that's almost certainly not what was intended.

(If there are cases where someone really wanted the old behavior for some reason, they can do Platform-conditional construction of XTypeGroups instead.)

Metadata

Metadata

Labels

P2Important issues not at the top of the work listp: file_selectorThe file_selector pluginpackageflutter/packages repository. See also p: labels.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions