Updates size to be in bytes instead of kb (#573)

This commit is contained in:
Miguel Ruivo 2021-01-04 15:10:27 +00:00
parent 2b22841e82
commit 55127843c9
5 changed files with 7 additions and 4 deletions

View File

@ -1,3 +1,6 @@
## 2.1.5
Updates `size` property from `PlatformFile` to be in bytes instead of kb.
## 2.1.4 ## 2.1.4
iOS: Fixes iOS ViewController which is nil when UIWindow.rootViewController have changed. ([#525](https://github.com/miguelpruivo/flutter_file_picker/issues/525)). Thank you @devcxm. iOS: Fixes iOS ViewController which is nil when UIWindow.rootViewController have changed. ([#525](https://github.com/miguelpruivo/flutter_file_picker/issues/525)). Thank you @devcxm.

View File

@ -173,7 +173,7 @@ public class FileUtils {
fileInfo fileInfo
.withPath(path) .withPath(path)
.withName(fileName) .withName(fileName)
.withSize(Integer.parseInt(String.valueOf(file.length()/1024))); .withSize(Integer.parseInt(String.valueOf(file.length())));
return fileInfo.build(); return fileInfo.build();
} }

View File

@ -90,7 +90,7 @@
[files addObject: [[[FileInfo alloc] initWithPath: path [files addObject: [[[FileInfo alloc] initWithPath: path
andName: [path lastPathComponent] andName: [path lastPathComponent]
andSize: [NSNumber numberWithLongLong: [@(fileAttributes.fileSize) longLongValue] / 1024] andSize: [NSNumber numberWithLongLong: [@(fileAttributes.fileSize) longLongValue]]
andData: loadData ? [NSData dataWithContentsOfFile:path options: 0 error:nil] : nil] toData]]; andData: loadData ? [NSData dataWithContentsOfFile:path options: 0 error:nil] : nil] toData]];
} }

View File

@ -33,7 +33,7 @@ class PlatformFile {
/// File content as stream /// File content as stream
final Stream<List<int>> readStream; final Stream<List<int>> readStream;
/// The file size in KB. /// The file size in bytes.
final int size; final int size;
/// File extension for this file. /// File extension for this file.

View File

@ -1,7 +1,7 @@
name: file_picker name: file_picker
description: A package that allows you to use a native file explorer to pick single or multiple absolute file paths, with extension filtering support. description: A package that allows you to use a native file explorer to pick single or multiple absolute file paths, with extension filtering support.
homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker
version: 2.1.4 version: 2.1.5
dependencies: dependencies:
flutter: flutter: