Skip to content

go_router match failure for an URI without a / character #181629

Description

@miklcct

Steps to reproduce

  1. Register the app to handle geo: URIs in Android
  2. Open a geo link, such as geo:51.5,0.0

Expected results

The app successfully process the link and handle it.

Actual results

The app throws an exception.

Specifying onEnter to pre-handle geo: links and block navigation doesn't solve the issue.

Code sample

Code sample
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

final _router = GoRouter(
  routes: [
    GoRoute(
      path: '/',
      builder: (context, state) =>
          MyHomePage(title: 'Flutter Demo Home Page', uri: state.uri),
    ),
  ],
);

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp.router(routerConfig: _router);
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key, required this.title, required this.uri});

  final String title;
  final Uri uri;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(title),
      ),
      body: Center(
        child: Text(
          uri.toString(),
          style: Theme.of(context).textTheme.headlineMedium,
        ),
      ),
    );
  }
}

Screenshots or Video

No response

Logs

Logs
======== Exception caught by foundation library ====================================================
The following assertion was thrown while dispatching notifications for GoRouteInformationProvider:
'package:go_router/src/match.dart': Failed assertion: line 256 pos 12: 'uriPathToCompare.startsWith(newMatchedLocationToCompare)': is not true.

When the exception was thrown, this was the stack: 
#2      RouteMatchBase._matchByNavigatorKeyForGoRoute (package:go_router/src/match.dart:256:12)
#3      RouteMatchBase._matchByNavigatorKey (package:go_router/src/match.dart:114:16)
#4      RouteMatchBase.match (package:go_router/src/match.dart:72:12)
#5      RouteConfiguration._getLocRouteMatches (package:go_router/src/configuration.dart:391:58)
#6      RouteConfiguration.findMatch (package:go_router/src/configuration.dart:347:42)
#7      GoRouteInformationParser.parseRouteInformationWithDependencies.<anonymous closure> (package:go_router/src/parser.dart:121:61)
#8      _OnEnterHandler.handleTopOnEnter (package:go_router/src/parser.dart:444:24)
#9      GoRouteInformationParser.parseRouteInformationWithDependencies (package:go_router/src/parser.dart:115:28)
#10     _RouterState._processRouteInformation (package:flutter/src/widgets/router.dart:778:10)
#11     _RouterState._handleRouteInformationProviderNotification (package:flutter/src/widgets/router.dart:799:5)
#12     ChangeNotifier.notifyListeners (package:flutter/src/foundation/change_notifier.dart:435:24)
#13     GoRouteInformationProvider.notifyListeners (package:go_router/src/information_provider.dart:160:11)
#14     GoRouteInformationProvider._platformReportsNewRouteInformation (package:go_router/src/information_provider.dart:274:5)
#15     GoRouteInformationProvider.didPushRouteInformation (package:go_router/src/information_provider.dart:325:5)
#16     WidgetsBinding._handlePushRouteInformation (package:flutter/src/widgets/binding.dart:1025:26)
<asynchronous suspension>
#17     MethodChannel._handleAsMethodCall (package:flutter/src/services/platform_channel.dart:608:42)
<asynchronous suspension>
#18     _DefaultBinaryMessenger.setMessageHandler.<anonymous closure> (package:flutter/src/services/binding.dart:653:22)
<asynchronous suspension>
(elided 2 frames from class _AssertionError)
The GoRouteInformationProvider sending notification was: Instance of 'GoRouteInformationProvider'
====================================================================================================
I/OpenGLRenderer(12479): Davey! duration=7413ms; Flags=1, FrameTimelineVsyncId=367532, IntendedVsync=23051489312622, Vsync=23051505979288, InputEventId=0, HandleInputStart=23051520692142, AnimationStart=23051520696049, PerformTraversalsStart=23051520698340, DrawStart=23051521536778, FrameDeadline=23051522645954, FrameInterval=23051520679590, FrameStartTime=16666666, SyncQueued=23051523266726, SyncStart=23051523544799, IssueDrawCommandsStart=23051525191205, SwapBuffers=23051555697767, FrameCompleted=23058903284900, DequeueBufferDuration=4465312, QueueBufferDuration=916667, GpuCompleted=23058903284900, SwapBuffersCompleted=23051558098601, DisplayPresentTime=0, 

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.35.7, on Ubuntu 25.10 6.17.0-8-generic, locale en_GB.UTF-8) [416ms]
    • Flutter version 3.35.7 on channel stable at /home/michael/snap/flutter/common/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision adc9010625 (3 months ago), 2025-10-21 14:16:03 -0400
    • Engine revision 035316565a
    • Dart version 3.9.2
    • DevTools version 2.48.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-lldb-debugging

[!] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [2.5s]
    • Android SDK at /home/michael/Android/Sdk
    • Emulator version 36.1.9.0 (build_id 13823996) (CL:N/A)
    • Platform android-36, build-tools 36.0.0
    • Java binary at: /usr/lib/jvm/java-17-openjdk-amd64/bin/java
      This JDK is specified by the JAVA_HOME environment variable.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 17.0.17+10-Ubuntu-125.10)
    ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses

[✓] Chrome - develop for the web [374ms]
    • CHROME_EXECUTABLE = microsoft-edge

[✓] Linux toolchain - develop for Linux desktop [10.1s]
    • clang version 10.0.0-4ubuntu1
    • cmake version 3.16.3
    • ninja version 1.10.0
    • pkg-config version 0.29.1
    • OpenGL core renderer: llvmpipe (LLVM 20.1.8, 256 bits)
    • OpenGL core version: 4.5 (Core Profile) Mesa 25.2.3-1ubuntu1
    • OpenGL core shading language version: 4.50
    • OpenGL ES renderer: llvmpipe (LLVM 20.1.8, 256 bits)
    • OpenGL ES version: OpenGL ES 3.2 Mesa 25.2.3-1ubuntu1
    • OpenGL ES shading language version: OpenGL ES GLSL ES 3.20
    • GL_EXT_framebuffer_blit: yes
    • GL_EXT_texture_format_BGRA8888: yes

[!] Android Studio (not installed) [372ms]
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/to/linux-android-setup for detailed instructions).

[✓] IntelliJ IDEA Ultimate Edition (version 2025.2) [372ms]
    • IntelliJ at /opt/idea
    • Flutter plugin version 88.0.0
    • Dart plugin version 252.25557.23

[✓] Connected device (3 available) [297ms]
    • Nokia 5 4 (mobile) • HZQL1849FAKC1001147 • android-arm64  • Android 12 (API 31)
    • Linux (desktop)    • linux               • linux-x64      • Ubuntu 25.10 6.17.0-8-generic
    • Chrome (web)       • chrome              • web-javascript • Microsoft Edge 144.0.3719.82

[✓] Network resources [300ms]
    • All expected network resources are available.

! Doctor found issues in 2 categories.

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listp: go_routerThe go_router packagepackageflutter/packages repository. See also p: labels.team-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework teamworkaround availableThere is a workaround available to overcome the issue

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions