title: location.getlocation() gives casting error on android flutter
body: <p>First importing and initializing the location package:</p>
  
  <pre><code>import 'package:location/location.dart' as locationPackage;
  
  locationPackage.Location location = new locationPackage.Location(); 
  </code></pre>
  
  <p>On android running the code:</p>
  
  <pre><code>try {
    await location.getLocation().then((pos) {
      setState(() {
        print(pos.runtimeType);
        _center = LatLng(pos.latitude, pos.longitude);;
        _lastMapPosition = _center;
      });
    });
  } catch (e) {
    print(e);
    if (e.code == 'PERMISSION_DENIED') {
     print("Permission Denied");
    }
  }
  }
  </code></pre>
  
  <p>Gives the error:</p>
  
  <pre><code>I/flutter ( 4326): NoSuchMethodError: Class 'int' has no instance method 'cast'.
  I/flutter ( 4326): Receiver: 1
  I/flutter ( 4326): Tried calling: cast&lt;String, double&gt;()
  E/flutter ( 4326): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: NoSuchMethodError: Class 'NoSuchMethodError' has no instance getter 'code'.
  
  E/flutter ( 4326): Receiver: Instance of 'NoSuchMethodError'
  E/flutter ( 4326): Tried calling: code
  E/flutter ( 4326): #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:50:5)
  E/flutter ( 4326): #1      _MapsSearchPageState._getLocation (package:Bartr/maps.dart:486:13)
  E/flutter ( 4326): &lt;asynchronous suspension&gt;
  E/flutter ( 4326): #2      _MapsSearchPageState.initState (package:Bartr/maps.dart:500:5)
  E/flutter ( 4326): #3      StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3846:58)
  E/flutter ( 4326): #4      ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
  E/flutter ( 4326): #5      Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
  E/flutter ( 4326): #6      Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
  E/flutter ( 4326): #7      SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
  E/flutter ( 4326): #8      Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
  E/flutter ( 4326): #9      Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
  E/flutter ( 4326): #10     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
  E/flutter ( 4326): #11     Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
  E/flutter ( 4326): #12     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
  E/flutter ( 4326): #13     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
  E/flutter ( 4326): #14     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
  E/flutter ( 4326): #15     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
  E/flutter ( 4326): #16     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
  E/flutter ( 4326): #17     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
  E/flutter ( 4326): #18     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
  E/flutter ( 4326): #19     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
  E/flutter ( 4326): #20     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
  E/flutter ( 4326): #21     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
  E/flutter ( 4326): #22     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
  E/flutter ( 4326): #23     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
  E/flutter ( 4326): #24     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
  E/flutter ( 4326): #25     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
  E/flutter ( 4326): #26     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
  E/flutter ( 4326): #27     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
  E/flutter ( 4326): #28     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
  E/flutter ( 4326): #29     Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
  E/flutter ( 4326): #30     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
  E/flutter ( 4326): #31     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3864:11)
  E/flutter ( 4326): #32     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
  E/flutter ( 4326): #33     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
  E/flutter ( 4326): #34     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
  E/flutter ( 4326): #35     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
  E/flutter ( 4326): #36     Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
  E/flutter ( 4326): #37     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
  E/flutter ( 4326): #38     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
  E/flutter ( 4326): #39     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
  E/flutter ( 4326): #40     Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
  E/flutter ( 4326): #41     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
  E/flutter ( 4326): #42     Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
  E/flutter ( 4326): #43     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
  E/flutter ( 4326): #44     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3864:11)
  E/flutter ( 4326): #45     Componen
  </code></pre>
  
  <p>This only happens on android. Firebase and all other packages appear to be working. I have followed the most modern installation rules for <code>package:location/location.dart</code>. I am using version  2.3.5 and flutter doctor shows all checkmarks for android development.  Any ideas why this is happening?</p>