filesystemSanitiser property

FilesystemSanitiserResult Function(String input) filesystemSanitiser
final

Method to sanitise any potentially unsafe String that will appear as a name of a FileSystemEntity

Takes a single String input. Must return a valid FilesystemSanitiserResult, as below.

FilesystemSanitiserResult.validOutput must be sanitised to be safe enough to be used in the filesystem. FilesystemSanitiserResult.errorMessages can be empty if there were no changes to the input. Alternatively, it can be one or more messages describing the issue with the input.

If the method is used internally in a validation situation, the output must be equal to the input, otherwise the error messages are thrown. This is, for example, the situation when managing stores and names. If the method is used internally in a sanitisation situation, error messages are ignored. This is, for example, the situation when storing map tiles.

Defaults to defaultFilesystemSanitiser - not perfect, but OK for most uses. Recommended to override, for example, if you need to remove the API key from a tile filename, which is not done by default.

Implementation

final FilesystemSanitiserResult Function(String input) filesystemSanitiser;