storage_space_info 1.0.0 copy "storage_space_info: ^1.0.0" to clipboard
storage_space_info: ^1.0.0 copied to clipboard

A Flutter plugin to get total, used and free storage for Android and iOS.

example/lib/main.dart

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

import 'package:storage_space_info/storage_space_info.dart';

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

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  double total = 0;
  double used = 0;
  double free = 0;

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  Future<void> initPlatformState() async {
    var data = await StorageSpaceInfo.getStorage();

    total = data.totalStorage;
    used = data.totalUsedStorage;
    free = data.totalFreeStorage;
    setState(() {});
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Plugin example app')),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Text("Total Storage :- ${total.toStringAsFixed(2)}"),
              SizedBox(height: 30),
              Text("Total Used Storage :- ${used.toStringAsFixed(2)}"),
              SizedBox(height: 30),
              Text("Total Free Storage :- ${free.toStringAsFixed(2)}"),
            ],
          ),
        ),
      ),
    );
  }
}
1
likes
150
points
11
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin to get total, used and free storage for Android and iOS.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on storage_space_info

Packages that implement storage_space_info