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

A new Flutter plugin.

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:document_provider/document_provider.dart';

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

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

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

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {

    try {
      _checkDirectory();
    } catch (error){
      print(error);
    }
  }

  void _checkDirectory() async{
    // get all the directories
    List<dynamic> file = await DocumentProvider.getAllDirectories(
        isTrim: true);

    //get the path of SD card Directory
    String externalDirectory = await DocumentProvider.getExternalDirectoryPath(isTrim: true);

    //get the path of Phone storage directory
    String internalDirectory = await DocumentProvider.getInternalDirectoryPath(isTrim: true);

  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Container()
      ),
    );
  }
}
0
likes
20
pub points
33%
popularity

Publisher

unverified uploader

A new Flutter plugin.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on document_provider