README.md

file_selector_aurora

The Aurora implementation of file_selector.

Usage

This package is not an endorsed implementation of file_selector. Therefore, you have to include file_selector_aurora alongside file_selector as dependencies in your pubspec.yaml file.

Supports only OS Aurora 5+!

pubspec.yaml

dependencies:
  file_selector: ^1.0.3
  file_selector_aurora:
    git:
      url: https://gitlab.com/omprussia/flutter/flutter-community-plugins/file_selector_aurora
      ref: aurora-0.0.5

*.desktop

Permissions=UserDirs

*.dart

Because file_selector_aurora works through Navigator, the plugin needs context to work.
Use FileSelectorAuroraKeyContainer.navigatorKey to set the key and put it to MaterialApp

import 'package:file_selector_aurora/file_selector_aurora.dart';

final navigatorKey = GlobalKey<NavigatorState>();

void main() {
  // Set FileSelectorAuroraKeyContainer.navigatorKey
  FileSelectorAuroraKeyContainer.navigatorKey = navigatorKey;
  runApp(const MyApp());
}
...
Widget build(BuildContext context) {
    // Put navigatorKey to MaterialApp
    return MaterialApp(
      navigatorKey: navigatorKey,
    );
}
...
import 'package:file_selector/file_selector.dart';
Future<void> _openImageFile(BuildContext context) async {
    const XTypeGroup typeGroup = XTypeGroup(
      extensions: <String>['jpg', 'png'],
    );

    final XFile? file = await openFile(acceptedTypeGroups: <XTypeGroup>[typeGroup]);
    
    print(file?.name);
}
Конвейеры
0 успешных
0 с ошибкой