open_filex 4.1.0 copy "open_filex: ^4.1.0" to clipboard
open_filex: ^4.1.0 copied to clipboard

A plug-in that can call native APP to open files with string result in flutter, support iOS(UTI) / android(intent) / PC(ffi) / web(dart:html)

example/lib/main.dart

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

import 'package:open_filex/open_filex.dart';

void main() => runApp(const MyApp());

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

  @override
  MyAppState createState() => MyAppState();
}

class MyAppState extends State<MyApp> {
  var _openResult = 'Unknown';

  Future<void> openFile() async {
    const filePath = '/storage/emulated/0/Download/flutter.png';
    final result = await OpenFilex.open(filePath);

    setState(() {
      _openResult = "type=${result.type}  message=${result.message}";
    });
  }

  @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: <Widget>[
              Text('open result: $_openResult\n'),
              TextButton(
                onPressed: openFile,
                child: const Text('Tap to open file'),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
298
likes
0
pub points
99%
popularity

Publisher

verified publisherbuildtoapp.com

A plug-in that can call native APP to open files with string result in flutter, support iOS(UTI) / android(intent) / PC(ffi) / web(dart:html)

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

ffi, flutter

More

Packages that depend on open_filex