byte_size 1.4.0 copy "byte_size: ^1.4.0" to clipboard
byte_size: ^1.4.0 copied to clipboard

outdated

ByteSize is a library that handles how byte sizes are represented and an easy to use interface to convert to other forms of representation also taking locale into consideration.

example/byte_size_example.dart

import 'package:byte_size/byte_size.dart';
import 'package:locales/locales.dart';
import 'dart:convert';

void main() {
  var size = ByteSize.FromKiloBytes(10000);
  print(size.toString('MB', 3, Locale.fr_CA)); // 9,766 MB

  var json = JsonEncoder();
  print(json.convert(size));
  // {"b":"81920000","B":"10240000.00000000000000000000","KB":"10000.00000000000000000000",
  // "MB":"9.76562500000000000000","GB":"0.00953674316406250000","TB":"0.00000931322574615479",
  // "PB":"0.00000000909494701773"}

  var size2 = size.copy();
  print(size2.toString('KB')); // 10,000 KB
}
4
likes
30
pub points
56%
popularity

Publisher

unverified uploader

ByteSize is a library that handles how byte sizes are represented and an easy to use interface to convert to other forms of representation also taking locale into consideration.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

intl, locales

More

Packages that depend on byte_size