file_sizes 1.0.6 file_sizes: ^1.0.6 copied to clipboard
Get the Human readable size of the file. It is purely written in dart and support both number and string as parameters.
import 'package:file_sizes/file_sizes.dart';
void main() {
/// Integer Values
///
/// 12.06 KB
print(FileSize.getSize(12345));
/// 12.06 KB
print(FileSize.getKiloBytes(12345));
/// 12.05566 KB
print(FileSize.getKiloBytes(12345, value: PrecisionValue.Five));
/// 96450.712 KB
print(FileSize.getKiloBytes(98765532, value: PrecisionValue.Three));
/// String Values
///
/// 12.06 KB
print(FileSize.getSize('12345'));
/// 12.06 KB
print(FileSize.getKiloBytes('12345'));
/// 12.05566 KB
print(FileSize.getKiloBytes('12345', value: PrecisionValue.Five));
/// 96450.712 KB
print(FileSize.getKiloBytes('98765532', value: PrecisionValue.Three));
}