title: how to download and save a file from internet to the internal storage(android) in Flutter/dart?
body: <p>i need to save file eg.jpg to "internalstorage/appname/files/"
  and show a notification if it does exists already in folder. when a button is pressed/activity intiated,it should download file to local storage of andorid device with dart code.
  help me find solution.</p>
  
  <pre><code>**code:**
     import 'dart:io';
    import 'dart:async';
    import 'package:flutter/material.dart';
   import 'package:flutter_downloader/flutter_downloader.dart';
   import './landing_page.dart';
   import 'package:dio/dio.dart';
   import 'package:path_provider/path_provider.dart';
   import 'package:simple_permissions/simple_permissions.dart';
   import 'package:flutter/services.dart';
  
  
   class MoviesPage extends StatefulWidget {
  
    @override
   State createState() =&gt; new MoviesPageState();
   }
  
   class MoviesPageState extends State&lt;MoviesPage&gt; {
    final dUrl ="https://cdn.putlockers.es/download/0BBCA7584749D4E741747E32E6EB588AEA03E40F";
   bool downloading = false;
   var progressString = "";
  static const MethodChannel _channel =
       const MethodChannel('flutter_downloader');
  
   @override
    void initState() {
      super.initState();
     downloadFile();
  
     }
  
  
    Future&lt;void&gt; downloadFile() async {
      Dio dio = Dio();
  
      try {
       var dir = await getApplicationDocumentsDirectory();
  
       await dio.download(dUrl, "${dir.path}/file.torrent",
            onProgress: (rec, total) {
            print("Rec: $rec , Total: $total");
  
         setState(() {
          downloading = true;
          progressString = ((rec / total) * 100).toStringAsFixed(0) + "%";
        });
       });
        } catch (e) {
        print(e);
        }
  
      setState(() {
       downloading = false;
       progressString = "Completed";
       });
       print("Download completed");
       }
      @override
       Widget build(BuildContext context) {
       return Scaffold(
            appBar: AppBar(
           title: Text("AppBar"),
          ),
       body: Center(
         child: downloading
             ? Container(
                 height: 120.0,
                width: 200.0,
                 child: Card(
                   color: Colors.black,
                   child: Column(
                       mainAxisAlignment: MainAxisAlignment.center,
                       children: &lt;Widget&gt;[
                         CircularProgressIndicator(),
                        SizedBox(
                      height: 20.0,
                    ),
                    Text(
                      "Downloading File: $progressString",
                      style: TextStyle(
                        color: Colors.white,
                      ),
                    )
                  ],
                ),
              ),
            )
          : Text("No Data"),
    ),
  );
   }
  }
  </code></pre>
  
  <p>thanks in advance.post your solutions in full fludged manner.</p>