diff --git a/packages/cross_file/CHANGELOG.md b/packages/cross_file/CHANGELOG.md index 8e43e986429c..ee6c5a2b7cdb 100644 --- a/packages/cross_file/CHANGELOG.md +++ b/packages/cross_file/CHANGELOG.md @@ -1,4 +1,4 @@ -## NEXT +## 0.3.5+3 * Updates minimum supported SDK version to Flutter 3.38/Dart 3.10. diff --git a/packages/cross_file/README.md b/packages/cross_file/README.md index 290295571877..d761c7736263 100644 --- a/packages/cross_file/README.md +++ b/packages/cross_file/README.md @@ -23,6 +23,9 @@ final String fileContent = await file.readAsString(); print('Content of the file: $fileContent'); ``` +The `mimeType` property is not inferred from the file path or contents. It is +only available if provided when the `XFile` was created. + You will find links to the API docs on the [pub page](https://pub.dev/packages/cross_file). ## Web Limitations diff --git a/packages/cross_file/lib/src/types/base.dart b/packages/cross_file/lib/src/types/base.dart index b3fb82ea4063..2f1edc5e4c70 100644 --- a/packages/cross_file/lib/src/types/base.dart +++ b/packages/cross_file/lib/src/types/base.dart @@ -45,7 +45,10 @@ abstract class XFileBase { throw UnimplementedError('.name has not been implemented.'); } - /// For web, it may be necessary for a file to know its MIME type. + /// The MIME type of the file. + /// + /// The value is not inferred from the file contents or path. It is only + /// available if provided when the [XFile] was created. String? get mimeType { throw UnimplementedError('.mimeType has not been implemented.'); } diff --git a/packages/cross_file/lib/src/types/html.dart b/packages/cross_file/lib/src/types/html.dart index 40703aa754fc..0f6faf8495bf 100644 --- a/packages/cross_file/lib/src/types/html.dart +++ b/packages/cross_file/lib/src/types/html.dart @@ -26,6 +26,9 @@ class XFile extends XFileBase { /// /// `name` needs to be passed from the outside, since it's only available /// while handling [html.File]s (when the ObjectUrl is created). + /// + /// [mimeType] is not inferred from [path] and is only available if explicitly + /// passed to the constructor. // ignore: use_super_parameters XFile( String path, { @@ -47,6 +50,9 @@ class XFile extends XFileBase { } /// Construct an CrossFile from its data + /// + /// [mimeType] is not inferred from [path] and is only available if explicitly + /// passed to the constructor. XFile.fromData( Uint8List bytes, { String? mimeType, diff --git a/packages/cross_file/lib/src/types/io.dart b/packages/cross_file/lib/src/types/io.dart index c1931a743a89..7e2c3c8d17a2 100644 --- a/packages/cross_file/lib/src/types/io.dart +++ b/packages/cross_file/lib/src/types/io.dart @@ -24,6 +24,9 @@ class XFile extends XFileBase { /// [length] is ignored; the parameter exists only to match the web version of /// the constructor. /// + /// [mimeType] is not inferred from [path] and is only available if explicitly + /// passed to the constructor. + /// // ignore: use_super_parameters XFile( String path, { @@ -40,6 +43,9 @@ class XFile extends XFileBase { /// Construct an CrossFile from its data /// + /// [mimeType] is not inferred from [path] and is only available if explicitly + /// passed to the constructor. + /// /// [name] is ignored; the parameter exists only to match the web version of /// the constructor. XFile.fromData( diff --git a/packages/cross_file/pubspec.yaml b/packages/cross_file/pubspec.yaml index 46a59f1a7cda..d0bb7119f1f2 100644 --- a/packages/cross_file/pubspec.yaml +++ b/packages/cross_file/pubspec.yaml @@ -2,7 +2,7 @@ name: cross_file description: An abstraction to allow working with files across multiple platforms. repository: https://github.com/flutter/packages/tree/main/packages/cross_file issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+cross_file%22 -version: 0.3.5+2 +version: 0.3.5+3 environment: sdk: ^3.10.0