Issue
I am using google_maps_flutter 1.0.6 plugin to display maps in my flutter app. The map is shown perfectly in debug version but it does not show in release build. I have entered the SHA1 key for the release build in the restrictions and have checked it multiple times and it is correct. I have also tried triggering the onMapsCreated method. It is triggered in debug build but it it does not run in the release build. Can someone explain what can I do to make Google maps work in the release build.
Here is the info about Flutter version I am using:
Flutter 1.22.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 8874f21e79 (3 weeks ago) • 2020-10-29 14:14:35 -0700
Engine • revision a1440ca392
Tools • Dart 2.10.3
Solution
The issue was with the widgets and not the Maps API and SHA1 key. I wrapped GoogleMap widget with Container and then wrapped the container with an Expanded widget. This widget tree was working perfectly in the debug build and was displaying the Map on the screen but in the release build somehow it did not show the map.
I just removed the Container and Expanded widget wrapping the GoogleMap widget. And it surprisingly worked in the release build.
Answered By - Umer Maqsood
Answer Checked By - Timothy Miller (JavaFixing Admin)