file_opener 0.0.2 copy "file_opener: ^0.0.2" to clipboard
file_opener: ^0.0.2 copied to clipboard

outdated

Plugin alows to open file with external app

example/lib/main.dart

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


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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _openResult = 'Unknown';

  Future<void> openFile() async {
    final filePath = '/storage/emulated/0/update.apk';
    final message = await FileOpener.open(filePath);

    setState(() {
      _openResult = message;
    });
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Text('open result: $_openResult\n'),
              FlatButton(
                child: Text('Tap to open file'),
                onPressed: openFile,
              ),
            ],
          ),
        ),
      ),
    );
  }
}
0
likes
20
pub points
18%
popularity

Publisher

unverified uploader

Plugin alows to open file with external app

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on file_opener