zuraffa_file_picker 1.0.1 copy "zuraffa_file_picker: ^1.0.1" to clipboard
zuraffa_file_picker: ^1.0.1 copied to clipboard

Typed file picking for the Zuraffa ecosystem: a pure-Dart FilePickerPort (pick, save, pick directory) with an in-memory default adapter and federated platform adapters.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:zuraffa/zuraffa.dart' show GetIt;
import 'package:zuraffa_file_picker/zuraffa_file_picker.dart';

import 'src/file_picker_home.dart';

/// Host app for the zuraffa_file_picker federated plugin.
///
/// It wires the real (method-channel) [FilePickerPort] onto GetIt via
/// [registerFilePickerDependencies] — the federated platform adapters
/// (`zuraffa_file_picker_android` / `_ios` / `_macos`) register their port
/// factory when Flutter starts the app, so the live mode exercises the
/// actual OS pickers. The simulator mode drives the package's pure-Dart
/// [InMemoryFilePickerAdapter] so every outcome — including cancellations
/// and files a real dialog would never hand you — can be staged and
/// observed on demand.
void main() {
  registerFilePickerDependencies(GetIt.instance);
  runApp(FilePickerApp(liveService: GetIt.instance<FilePickerService>()));
}

/// The example app root.
///
/// Both modes share the public [FilePickerService] API; only the adapter
/// behind the port differs (in-memory simulator vs. the GetIt-registered
/// live stack).
class FilePickerApp extends StatelessWidget {
  const FilePickerApp({super.key, this.liveService, this.simulatorAdapter});

  /// Service behind the live mode; defaults to the instance GetIt
  /// registered.
  final FilePickerService? liveService;

  /// The scripted adapter behind the simulator mode.
  final InMemoryFilePickerAdapter? simulatorAdapter;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'zuraffa_file_picker',
      theme: ThemeData(useMaterial3: true),
      home: FilePickerHome(
        liveService: liveService,
        simulatorAdapter: simulatorAdapter,
      ),
    );
  }
}
0
likes
160
points
251
downloads

Documentation

API reference

Publisher

verified publisherzuraffa.com

Weekly Downloads

Typed file picking for the Zuraffa ecosystem: a pure-Dart FilePickerPort (pick, save, pick directory) with an in-memory default adapter and federated platform adapters.

Homepage
Repository (GitHub)
View/report issues

Topics

#file-picker #clean-architecture #zuraffa #state

License

MIT (license)

Dependencies

json_annotation, zorphy_annotation, zuraffa

More

Packages that depend on zuraffa_file_picker