title: Why camera is not working from image picker?
body: <p>Here is the code, I am using for image_picker to display a camera or gallery image. Using additionally as a .dart file in the main function I am running this code under RunApp().</p>
  
  <pre><code>import 'dart:io';
  import 'package:flutter/material.dart';
  import 'package:image_picker/image_picker.dart';
  import 'package:modal_progress_hud/modal_progress_hud.dart';
  class Display_Image extends StatefulWidget {
    @override
    _Display_ImageState createState() =&gt; _Display_ImageState();
  }
  
  class _Display_ImageState extends State&lt;Display_Image&gt; {
    File _image;
    void ImageGrab(int i)
    async {
      setState(() {
        ShowSpinner=true;
      });
      try
      {
        if(i==1) {
          File gallerfile = await ImagePicker.pickImage(
              source: ImageSource.gallery);
          _image=gallerfile;
          setState(() {
            ShowSpinner=false;
          });
        }
        else {
          File gallerfile = await ImagePicker.pickImage(
              source: ImageSource.camera);
          _image=gallerfile;
  
        setState(() {
          ShowSpinner=false;
        });}
        //print('Selected image path: ${gallerfile.path}');
  
      }
      catch(e)
      {
        print(e);
      }
  
    }
    bool ShowSpinner=false;
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(
          title: Text('Image Picker Test'),
        ),
        //backgroundColor: Colors.deepPurpleAccent,
        body: ModalProgressHUD(
          inAsyncCall: ShowSpinner,
          child: Column(
            children: &lt;Widget&gt;[
              //SizedBox(height: 10,),
              Container(
                color: Colors.deepPurpleAccent,
                height: 50,
                child: Row(
                  children: &lt;Widget&gt;[
                    SizedBox(width: 20,),
                    FlatButton(
                      child: Icon(Icons.camera),
                      onPressed: (){
                        ImageGrab(0);
                      },
                    ),
                    SizedBox(width: 120,),
                    FlatButton(
                      child: Icon(Icons.image),
                      onPressed: (){
                        ImageGrab(1);
                      },
                    ),
                    SizedBox(width: 20,)
                  ],
                ),
              ),
              //SizedBox(height: 10,),
              Expanded(
                child:Container(
                  width: double.infinity,
                  child: _image==null?Text('Image Appears here'):Image.file(_image),
                  color: Colors.greenAccent,
                ),
              ),
            ],
          ),
        ),
      );
    }
  }
  </code></pre>
  
  <p>Here's the UI image:</p>
  
  <p><a href="https://i.stack.imgur.com/meC7w.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/meC7w.jpg" alt="enter image description here"></a></p>
  
  <p>Now the two problems, I am facing are:
  1. When I use the camera button to display the camera image, camera UI opens, I capture the image, press the check button and the UI keeps loading but the image is not displayed.
  2. When I restart the app and re-run it, again the UI keeps loading, even if I press gallery button which works well when I run the app from the scratch, it displays a message in the console saying:</p>
  
  <blockquote>
    <p>I/flutter (14072): PlatformException(already_active, Image picker is
    already active, null)</p>
  </blockquote>
  
  <p>Note this happens only while encountering the second case of the cases I have mentioned.
  Moreover, I am using the version number <strong>image_picker: ^0.5.4+1</strong> as I am using mlkit libraries of firebase, which throws a huge error with lots of messages if I use image_picker's new versions. </p>
  
  <p>Kindly look into this and let me know how do I proceed further with this. Thanks in advance.</p>