A professional demonstration of Google Maps integration in Flutter with specialized iOS configuration. This project showcases native iOS setup, location services implementation, and custom map widgets.
This code sample represents key contributions I made to a private GIS application project. Since the original project is private, I've isolated and refined the Google Maps integration component to demonstrate:
- β Native iOS Configuration - Proper setup of Google Maps for iOS
- β Location Permission Handling - iOS-specific permission requests
- β Custom Map Widgets - Reusable, production-ready components
- β Best Practices - Secure API key management and error handling
Note: The video demonstrates the original GIS application running with this Google Maps integration.
https://drive.google.com/file/d/1_Molho-zS5ojjqP28m-YdkOxagyMvmGD/view?usp=sharing
Demo video is linked above. To include your own demo, either update the link above or add a demo/app_demo.mp4 file to the repository and mention it here.
- Tap-to-select location on map
- Automatic current location detection
- Real-time coordinate display
- Visual marker feedback
- Display saved locations
- Non-interactive view for data presentation
- Clean, consistent UI design
- API keys stored in
.xcconfigfiles (excluded from git) - Environment-based configuration
- Production-ready security practices
- Proper
Info.plistpermissions - Google Maps SDK initialization in
AppDelegate - iOS 14.0+ compatibility
platform :ios, '14.0'
use_frameworks!
use_modular_headers!
target 'Runner' do
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
endimport UIKit
import Flutter
import GoogleMaps
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
let googleMapsAPIKey = Bundle.main.object(forInfoDictionaryKey: "GoogleMapsAPIKey") as? String
if let apiKey = googleMapsAPIKey {
GMSServices.provideAPIKey(apiKey)
} else {
fatalError("Google Maps API key not found in Info.plist")
}
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}Essential iOS permissions for location services:
<key>NSLocationWhenInUseUsageDescription</key>
<string>This app needs access to your location to show it on the map.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>This app needs your location to provide location-based features.</string>
<key>GoogleMapsAPIKey</key>
<string>$(GOOGLE_MAPS_API_KEY)</string>GOOGLE_MAPS_API_KEY=YOUR_API_KEY_HERE
Interactive map for selecting locations with:
- Automatic current location fetch
- Tap gesture handling
- Permission management
- Marker placement
Display-only map component for:
- Showing saved locations
- Data visualization
- Non-interactive presentation
- Flutter SDK (3.0+)
- Xcode 14+
- CocoaPods
- Google Maps API Key (Get one here)
- Clone the repository
git clone https://github.com/yashnandwanii/flutter-google-maps-ios-setup-demo.git
cd flutter-google-maps-ios-setup-demo- Install dependencies
flutter pub get
cd ios && pod install && cd ..- Configure Google Maps API Key
Create/edit ios/Flutter/MyKeys.xcconfig:
GOOGLE_MAPS_API_KEY=YOUR_ACTUAL_API_KEY_HERE
MyKeys.xcconfig to .gitignore to keep your key secure!
- Update Xcode Configuration
In Xcode, ensure MyKeys.xcconfig is imported in your build configurations:
- Open
ios/Runner.xcodeproj - Select Runner target β Build Settings
- Verify that Debug/Release configurations include
MyKeys.xcconfig
- Run the app
flutter rundependencies:
google_maps_flutter: ^2.12.3 # Google Maps integration
geolocator: ^14.0.2 # Location services
geocoding: ^4.0.0 # Address lookup (optional)
get: ^4.7.2 # State managementlib/
βββ main.dart # App entry point & demo UI
βββ widgets/
βββ pick_location_map.dart # Interactive map widget
βββ read_only_map.dart # Display-only map widget
ios/
βββ Podfile # iOS dependencies
βββ Runner/
β βββ AppDelegate.swift # Google Maps initialization
β βββ Info.plist # iOS permissions & config
βββ Flutter/
βββ MyKeys.xcconfig # Secure API key storage (gitignored)
- β Swift integration with Flutter
- β
iOS permission handling (
Info.plist) - β CocoaPods dependency management
- β Xcode project configuration
- β Google Maps Flutter plugin implementation
- β Custom reusable widget development
- β Location services (Geolocator)
- β State management
- β Asynchronous operations
- β Secure API key management
- β Error handling & null safety
- β Clean code architecture
- β Documentation & comments
- β Production-ready configuration
Solution: Ensure MyKeys.xcconfig exists and is properly configured in Xcode build settings.
Solution:
- Check iOS Simulator β Features β Location β Custom Location
- Verify location permissions in iOS Settings app
- Ensure
Info.plisthas location permission strings
Solution:
cd ios
rm -rf Pods Podfile.lock
pod cache clean --all
pod install- Open iOS Simulator
- Features β Location β Apple (or custom location)
- Run the app:
flutter run - Grant location permissions when prompted
This showcase is derived from a larger private GIS application where I was responsible for:
- ποΈ Native iOS integration for Google Maps
- π§ Fixing critical iOS build errors related to Podfile and Xcode configuration
- π Implementing location-based features including map picking, area calculation, and geocoding
- π¨ Designing reusable map widgets used throughout the application
- π± iOS-specific optimizations for performance and user experience
- Flutter & Dart
- Google Maps (iOS & Android)
- RESTful API integration
- State management (GetX)
- Image handling & compression
- Secure authentication (JWT)
Created by Yash Nandwani as a portfolio demonstration of Flutter iOS development skills.
Contact:
- GitHub: @yashnandwanii
- Email: yashnandwani47@gmail.com
β If you find this helpful, please consider giving it a star!
This is a code sample demonstrating specific technical skills and is not intended for production use without further development.