Skip to content

google_maps is not drawing customized Polyline on iOS #60083

Closed

Description

@ahmaducg

I'm using the following style of Polyline to draw one the google_maps

Polyline(
          polylineId: PolylineId("${polylineId++}"),
          width: 4,
          points: points,
          patterns: isWalking
              ? path
                  .map(
                    (_) => PatternItem.dot,
                  )
                  .toList()
              : [],
          color: ColorRes.colorSecondaryLight,
          jointType: JointType.round,
          startCap: Cap.roundCap,
          endCap: Cap.roundCap,
        )

The Polyline appears normal on Android, but it uses the default style on iOS (like I didn't use any styling)
It draws the Polyline, just not using any customizations.

Flutter Doctor :

flutter doctor -v
[✓] Flutter (Channel stable, v1.17.4, on Mac OS X 10.15.4 19E287, locale en-SY)
    • Flutter version 1.17.4 at /Users/ucgmacmini/Library/flutter
    • Framework revision 1ad9baa8b9 (6 days ago), 2020-06-17 14:41:16 -0700
    • Engine revision ee76268252
    • Dart version 2.8.4

 
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0-rc1)
    • Android SDK at /Users/ucgmacmini/Library/Android/sdk
    • Platform android-30, build-tools 30.0.0-rc1
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3.1, Build version 11C505
    • CocoaPods version 1.9.1

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 46.0.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[!] IntelliJ IDEA Community Edition (version 2020.1.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

[!] VS Code (version 1.45.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    ✗ Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
    • Android SDK built for x86 • emulator-5554                        • android-x86 • Android 10 (API 29) (emulator)
    • iPhone 11 Pro             • 7CF0AEC0-6B2F-4EDA-9C70-5941AE459EED • ios         • com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)

! Doctor found issues in 2 categories.
google_maps : v0.5.28+1

I've tested on an Emulator and on a Physical Device

Activity

  1. iapicca commented on Jun 24, 2020

    @iapicca

    I’m unable to reproduce the issue to pinpoint the cause, but there are reports from several users.
    The issue needs further investigation.

  2. vanlooverenkoen commented on Jun 24, 2020

    @vanlooverenkoen
    Contributor

    @iapicca

          GoogleMap(
              initialCameraPosition: _kGooglePlex,
              onMapCreated: _onMapCreated,
              markers: markers,
              polylines: {
                Polyline(
                  polylineId: PolylineId('1'),
                  color: ThemeColors.primary,
                  width: 2,
                  patterns: [
                    PatternItem.dash(8),
                    PatternItem.gap(15),
                  ],
                  points: const [
                    LatLng(37.42796133580664, -122.085749655962),
                    LatLng(36.42796133580664, -123.08575),
                  ],
                ),
              },
            ),
    

    I have the problem with this code

  3. Hixie commented on Jun 30, 2020

    @Hixie
    Contributor

    @vanlooverenkoen Can you submit a pubspec.yaml and lib/main.dart which, when placed into the flutter create template, reproduces this bug?

  4. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jun 30, 2020
  5. vanlooverenkoen commented on Jul 15, 2020

    @vanlooverenkoen
    Contributor

    @Hixie

    My App:

    import 'dart:async';
    import 'package:flutter/material.dart';
    import 'package:google_maps_flutter/google_maps_flutter.dart';
    
    void main() {
      runApp(MyApp());
    }
    
    class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Flutter Demo',
          theme: ThemeData(
            primarySwatch: Colors.blue,
            visualDensity: VisualDensity.adaptivePlatformDensity,
          ),
          home: Maps(),
        );
      }
    }
    
    class Maps extends StatefulWidget {
      @override
      State<Maps> createState() => _MapsState();
    }
    
    class _MapsState extends State<Maps> {
      final _controller = Completer<GoogleMapController>();
    
      @override
      Widget build(BuildContext context) {
        return Stack(
          children: [
            GoogleMap(
              initialCameraPosition: const CameraPosition(
                target: LatLng(51.217566, 4.416834),
                zoom: 13,
              ),
              onMapCreated: _onMapCreated,
              zoomControlsEnabled: false,
              myLocationButtonEnabled: false,
              polylines: {
                Polyline(
                  polylineId: PolylineId('1'),
                  width: 2,
                  patterns: [
                    PatternItem.dash(8),
                    PatternItem.gap(15),
                  ],
                  points: const [
                    LatLng(51.235478, 4.428747),
                    LatLng(51.198200, 4.402847),
                  ],
                ),
              },
            ),
          ],
        );
      }
    
      void _onMapCreated(GoogleMapController controller) {
        _controller.complete(controller);
      }
    }

    My Pubspec:

    name: maps_issue
    description: A new Flutter application.
    version: 1.0.0+1
    
    environment:
      sdk: ">=2.7.0 <3.0.0"
    
    dependencies:
      flutter:
        sdk: flutter
      cupertino_icons: ^0.1.3
      google_maps_flutter: ^0.5.28+1
    
    dev_dependencies:
      flutter_test:
        sdk: flutter
    
    flutter:
      uses-material-design: true
    
  6. vanlooverenkoen commented on Jul 21, 2020

    @vanlooverenkoen
    Contributor

    @Hixie i have added the example but waiting on customer is still added to this ticket

  7. no-response commented on Jul 24, 2020

    @no-response

    Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
    Thanks for your contribution.

  8. 47 remaining items

  9. Colman commented on May 29, 2024

    @Colman

    After the fix in;

    google_maps_flutter_ios: 2.6.1

    It still seems like the following pattern doesn't display:

    [
      PatternItem.dot,
      PatternItem.gap(8.0),
    ]

    Build targeting iOS 14, running on iOS 17.5.1. Same result when targeting iOS 15, running on iOS 17.5.1.

  10. Hari-07 commented on Jun 7, 2024

    @Hari-07
    Member

    @Colman

    Currently the Polyline pattern just does dash and solid. From what I could see, dots were done in a completely different way in the ios SDK (Stamp Style). It's not consistent between android and ios, so at the moment dot will not work on ios.

    https://developers.google.com/maps/documentation/ios-sdk/shapes#add-a-repeating-color-pattern-to-a-polyline

  11. markokosticdev commented on Jul 30, 2024

    @markokosticdev

    startCap and endCap dont work at all on iOS, so I am not able to use startCap: Cap.roundCap and endCap: Cap.customCapFromBitmap(bitmap)

  12. GiuseppeMaffiaAlten commented on Feb 7, 2025

    @GiuseppeMaffiaAlten
  13. radikris commented on Mar 14, 2025

    @radikris
  14. frapeti commented on Jun 17, 2025

    @frapeti
  15. stuartmorgan-g commented on Sep 12, 2025

    @stuartmorgan-g
    Contributor

    Closing, as this was supposed to be closed by flutter/packages#5757 but the PR didn't have quite the right annotation to auto-close. Please file new issues for any specific follow-up (e.g., dots).

  16. github-actions commented on Sep 26, 2025

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  17. locked as resolved and limited conversation to collaborators on Sep 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listfound in release: 1.22Found to occur in 1.22found in release: 1.26Found to occur in 1.26found in release: 2.0Found to occur in 2.0found in release: 2.3Found to occur in 2.3has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: mapsGoogle Maps pluginpackageflutter/packages repository. See also p: labels.platform-iosiOS applications specificallyteam-iosOwned by iOS platform teamtriaged-iosTriaged by iOS platform team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions