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

A Flutter package that provides a clean way to handle storage directory path on both web and non-web platforms and debug and release builds.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:dynamic_storage_directory/dynamic_storage_directory.dart';
import 'package:hydrated_bloc/hydrated_bloc.dart';
import 'package:path_provider/path_provider.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  // Initialize Hydrated Bloc Storage dynamically.
  HydratedBloc.storage = await HydratedStorage.build(
    storageDirectory: await getStorageDirectory(
      webStorageDirectory: HydratedStorage
          .webStorageDirectory, // web storage directory specified by hydrated_bloc
      releaseStorageDirectory:
          getApplicationSupportDirectory(), // release storage directory specified by developer
    ),
  );

  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Scaffold(
        body: Placeholder(),
      ),
    );
  }
}
0
likes
150
points
16
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package that provides a clean way to handle storage directory path on both web and non-web platforms and debug and release builds.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on dynamic_storage_directory