DiskSizeFormatter class
Utility functions for formatting byte sizes into human-readable strings.
Example usage:
import 'package:windows_disk_utils/disk_size_formatter.dart';
void main() {
print(DiskSizeFormatter.formatBytes(1536)); // 1.54 KB
print(DiskSizeFormatter.formatBytes(1536, binary: true)); // 1.50 KiB
print(DiskSizeFormatter.formatBytes(1048576)); // 1.05 MB
print(DiskSizeFormatter.formatBytes(1048576, binary: true)); // 1.00 MiB
}
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
formatBytes(
int bytes, {int decimals = 2, bool binary = false}) → String - Converts a byte value to a human-readable string (e.g., KB, MB, GB).