title: How to upload a video from gallery in flutter
body: <p>I am building an app when a user clicks the button, it goes to gallery and select any of the video in gallery and then returns back to the main screen in app and plays the video automatically. Below is code i have tried.</p>
  
  <pre><code>void main() =&gt; runApp(MyApp());
  class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        debugShowCheckedModeBanner: false,
        title: 'Flutter Image App Demo',
        theme: ThemeData(
          primaryColor: Color(0xff476cfb),
        ),
        home: MyHomePage(),
      );
    }
  }
  
  class MyHomePage extends StatefulWidget {
    @override
    _MyHomePageState createState() =&gt; _MyHomePageState();
  }
  
  class _MyHomePageState extends State&lt;MyHomePage&gt; {
    File _imageFile;
    Future getVideo() async{
      File image;
      image=await ImagePicker.pickVideo(source: ImageSource.gallery);
      setState(() {
        _imageFile=image;
      });
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(
          title: Text("Image Upload"),
        ),
        body: ListView(
          children: &lt;Widget&gt;[
            Center(
              child: Column(
                children: &lt;Widget&gt;[
                  SizedBox(height: 10.0,),
                  RaisedButton(
                    child: Text("Video"),
                    onPressed: (){
                      getVideo();
                    },
                  ),
                ],
              ),
            )
          ],
  }
  </code></pre>