document_file_save_plus 1.0.3 copy "document_file_save_plus: ^1.0.3" to clipboard
document_file_save_plus: ^1.0.3 copied to clipboard

outdated

Save bytes data into Download folder (Android), or show save dialog (iOS).

example/lib/main.dart

import 'dart:typed_data';
import 'package:document_file_save_plus/document_file_save_plus.dart';
import 'package:flutter/material.dart';
import 'dart:convert';

void main() {
  runApp(MyApp());
}

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

class _MyAppState extends State<MyApp> {

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

    List<int> htmlBytes = utf8.encode("<h1>Header 1</h1><p>This is sample text</p>");
    List<int> textBytes = utf8.encode("Some data");
    Uint8List htmlBytes1 = Uint8List.fromList(htmlBytes);
    Uint8List textBytes1 = Uint8List.fromList(textBytes);

    // save multiple files
    DocumentFileSavePlus.saveMultipleFiles([htmlBytes1, textBytes1], ["htmlfile.html", "textfile.txt"], ["text/html", "text/plain"]);

    // save multiple files (case that file have same name). system will automatically append number to filename.
    //DocumentFileSave.saveMultipleFiles([htmlBytes, textBytes], ["file.txt", "file.txt"], ["text/html", "text/plain"]);

    // save single file
    // DocumentFileSave.saveFile(htmlBytes, "my test html file.html", "text/html");
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('document_file_save Plugin'),
        ),
        body: Center(
          child: Text('Please check file in Download folder (or Files App in iOS)'),
        ),
      ),
    );
  }

}
52
likes
0
points
15.5k
downloads

Publisher

unverified uploader

Weekly Downloads

Save bytes data into Download folder (Android), or show save dialog (iOS).

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on document_file_save_plus