File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11## NEXT
22
3+ * Clarifies that ` XFile.mimeType ` is not inferred from the file path or contents.
34* Updates minimum supported SDK version to Flutter 3.35/Dart 3.9.
45
56## 0.3.5+2
Original file line number Diff line number Diff line change @@ -23,6 +23,10 @@ final String fileContent = await file.readAsString();
2323print('Content of the file: $fileContent');
2424```
2525
26+ The ` mimeType ` property is not inferred from the file path or contents. It is
27+ only available if provided when the ` XFile ` was created, or if available from the
28+ platform-backed file.
29+
2630You will find links to the API docs on the [ pub page] ( https://pub.dev/packages/cross_file ) .
2731
2832## Web Limitations
Original file line number Diff line number Diff line change @@ -45,7 +45,11 @@ abstract class XFileBase {
4545 throw UnimplementedError ('.name has not been implemented.' );
4646 }
4747
48- /// For web, it may be necessary for a file to know its MIME type.
48+ /// The MIME type of the file.
49+ ///
50+ /// The value is not inferred from the file contents or path. It is only
51+ /// available if provided when the [XFile] was created, or if available from
52+ /// the platform-backed file.
4953 String ? get mimeType {
5054 throw UnimplementedError ('.mimeType has not been implemented.' );
5155 }
Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ class XFile extends XFileBase {
2626 ///
2727 /// `name` needs to be passed from the outside, since it's only available
2828 /// while handling [html.File] s (when the ObjectUrl is created).
29+ ///
30+ /// [mimeType] is only available if explicitly passed to the constructor.
2931 // ignore: use_super_parameters
3032 XFile (
3133 String path, {
@@ -47,6 +49,8 @@ class XFile extends XFileBase {
4749 }
4850
4951 /// Construct an CrossFile from its data
52+ ///
53+ /// [mimeType] is only available if explicitly passed to the constructor.
5054 XFile .fromData (
5155 Uint8List bytes, {
5256 String ? mimeType,
Original file line number Diff line number Diff line change @@ -24,6 +24,9 @@ class XFile extends XFileBase {
2424 /// [length] is ignored; the parameter exists only to match the web version of
2525 /// the constructor.
2626 ///
27+ /// [mimeType] is not inferred from [path] and is only available if explicitly
28+ /// passed to the constructor.
29+ ///
2730 // ignore: use_super_parameters
2831 XFile (
2932 String path, {
@@ -40,6 +43,8 @@ class XFile extends XFileBase {
4043
4144 /// Construct an CrossFile from its data
4245 ///
46+ /// [mimeType] is only available if explicitly passed to the constructor.
47+ ///
4348 /// [name] is ignored; the parameter exists only to match the web version of
4449 /// the constructor.
4550 XFile .fromData (
You can’t perform that action at this time.
0 commit comments