disk 0.3.3 copy "disk: ^0.3.3" to clipboard
disk: ^0.3.3 copied to clipboard

PlatformAndroid

A flutter plugin for android to get storage volumes' information.

example/lib/main.dart

import 'package:disk/disk.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Disk Details'),
        ),
        body: StreamBuilder(
          stream: StorageVolumes.stream(interval: const Duration(seconds: 10)),
          builder: (context, snapshot) {
            if (!snapshot.hasData) {
              return const Center(
                child: CircularProgressIndicator(),
              );
            }
            StorageVolumes storageVolumes = snapshot.data as StorageVolumes;

            return Padding(
              padding: const EdgeInsets.all(50.0),
              child: ListView.builder(
                itemCount: storageVolumes.length,
                itemBuilder: (context, index) {
                  return FutureBuilder(
                    future: storageVolumes.listCache![index].cacheDetails(),
                    builder: (context, snapshot) {
                      StorageVolume? storageVolume =
                          storageVolumes.listCache?[index];

                      if (storageVolume == null) return const SizedBox();
                      return Column(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Text("Name: ${storageVolume.name}"),
                          Text("Path: ${storageVolume.path}"),
                          Text(
                            "Total Space: ${storageVolume.totalSpaceCache} Bytes",
                          ),
                          Text(
                            "Used Space: ${storageVolume.usedSpaceCache} Bytes",
                          ),
                          Text(
                            "Free Space: ${storageVolume.freeSpaceCache} Bytes",
                          ),
                          const SizedBox(
                            height: 50.0,
                          )
                        ],
                      );
                    },
                  );
                },
              ),
            );
          },
        ),
      ),
    );
  }
}
3
likes
120
pub points
47%
popularity

Publisher

verified publisherhextools.0xba1.xyz

A flutter plugin for android to get storage volumes' information.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

equatable, flutter, path_provider

More

Packages that depend on disk