A Flutter package that provides an easy way to get disk space information on Android devices.
  • Dart 75.9%
  • Kotlin 18.8%
  • Makefile 5.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-06-10 22:11:57 +02:00
android feat: add unit conversion and smart formatting for disk space 2026-06-10 21:48:21 +02:00
example feat: add unit conversion and smart formatting for disk space 2026-06-10 21:48:21 +02:00
lib feat: add unit conversion and smart formatting for disk space 2026-06-10 21:48:21 +02:00
test feat: add unit conversion and smart formatting for disk space 2026-06-10 21:48:21 +02:00
.fvmrc chore: add Makefile and FVM version config 2026-06-10 13:33:07 +02:00
.gitignore build: upgrade Gradle Kotlin DSL and bump pubspec dependencies to latest versions 2026-06-10 21:02:49 +02:00
.metadata build: upgrade Gradle Kotlin DSL and bump pubspec dependencies to latest versions 2026-06-10 21:02:49 +02:00
analysis_options.yaml feat: add unit conversion and smart formatting for disk space 2026-06-10 21:48:21 +02:00
CHANGELOG.md chore: bump version to 0.1.0 and update CHANGELOG 2026-06-10 22:11:57 +02:00
LICENSE Initial commit 2024-12-08 19:35:01 +01:00
Makefile feat: add unit conversion and smart formatting for disk space 2026-06-10 21:48:21 +02:00
pubspec.yaml chore: bump version to 0.1.0 and update CHANGELOG 2026-06-10 22:11:57 +02:00
README.md feat: add unit conversion and smart formatting for disk space 2026-06-10 21:48:21 +02:00

Storage Monitor

A Flutter plugin to query disk space on Android — available and total — with built-in unit conversion and smart formatting.

Features

  • Raw bytes via getAvailableDiscSpace() / getTotalDiscSpace()
  • Explicit unit conversion via getAvailableDiscSpaceAs(StorageUnit.mb)
  • Auto-picks the most readable unit via getAvailableDiscSpaceSmart()

Usage

import 'package:storage_monitor/storage_monitor.dart';

Raw bytes

final int? bytes = await StorageMonitor.getAvailableDiscSpace();

Explicit unit

final double? mb = await StorageMonitor.getAvailableDiscSpaceAs(StorageUnit.mb);
final double? gb = await StorageMonitor.getTotalDiscSpaceAs(StorageUnit.gb);

Smart formatting

The smart methods pick the largest unit where the value is ≥ 0.1.
For example, 85 MB (= 0.08 GB) is returned as 85.00 MB, not 0.08 GB.

final StorageSize? available = await StorageMonitor.getAvailableDiscSpaceSmart();
final StorageSize? total    = await StorageMonitor.getTotalDiscSpaceSmart();

print(available);        // e.g. "85.00 MB"
print(total);            // e.g. "128.00 GB"

// Access value and unit separately:
print(available?.value); // 85.0
print(available?.unit);  // StorageUnit.mb
print(available?.unit.label); // "MB"

StorageUnit

Value Label
StorageUnit.bytes B
StorageUnit.kb KB
StorageUnit.mb MB
StorageUnit.gb GB

License

This project is licensed under the MIT license.