Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimal null safe code using vrouter not working. #4

Closed
grinder15 opened this issue Feb 23, 2021 · 2 comments
Closed

Minimal null safe code using vrouter not working. #4

grinder15 opened this issue Feb 23, 2021 · 2 comments

Comments

@grinder15
Copy link

Running this code with null safety on (using null safe version of the package ofc)

import 'package:flutter/material.dart';
import 'package:vrouter/vrouter.dart';

void main() {
  runApp(
    VRouter(
      debugShowCheckedModeBanner: false, // VRouter acts as a MaterialApp
      mode: VRouterModes.history,
      routes: [
        // The path '/' goes to ProfileWidget
        VStacked(path: '/', widget: ProfileWidget()),
        // The path '/info' goes to InfoWidget
        VStacked(path: '/info', widget: InfoWidget()),
      ],
    ),
  ); // Remove the '#' from the url
}

class ProfileWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Profile'),
      ),
      body: Center(
        child: Row(
          children: [
            Text('Profile'),
            ElevatedButton(
              onPressed: () {
                VRouterData.of(context).push('/info');
              },
              child: Text('Go to Info'),
            ),
          ],
        ),
      ),
    );
  }
}

class InfoWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Info'),
      ),
      body: Center(
        child: Text('Info'),
      ),
    );
  }
}

and I got this error,

E/flutter (10296): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: type '_InternalLinkedHashMap<String, String?>' is not a subtype of type 'Map<String, String>' of 'other'
E/flutter (10296): #0      MapMixin.addAll (dart:collection/maps.dart)
E/flutter (10296): #1      VRouterState._updateUrl (package:vrouter/src/router.dart:1409:14)
E/flutter (10296): #2      VRouterState.build.<anonymous closure> (package:vrouter/src/router.dart:603:17)
E/flutter (10296): #3      VRouterState.build.<anonymous closure> (package:vrouter/src/router.dart:586:11)
E/flutter (10296): #4      SimpleRouterDelegate.setNewRoutePath (package:simple_url_handler/simple_url_handler.dart:496:20)
E/flutter (10296): #5      RouterDelegate.setInitialRoutePath (package:flutter/src/widgets/router.dart:1077:12)
E/flutter (10296): #6      _rootRunUnary (dart:async/zone.dart:1362:47)
E/flutter (10296): #7      _CustomZone.runUnary (dart:async/zone.dart:1265:19)
E/flutter (10296): #8      _FutureListener.handleValue (dart:async/future_impl.dart:152:18)
E/flutter (10296): #9      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:704:45)
E/flutter (10296): #10     Future._propagateToListeners (dart:async/future_impl.dart:733:32)
E/flutter (10296): #11     Future._completeWithValue (dart:async/future_impl.dart:539:5)
E/flutter (10296): #12     Future._chainForeignFuture.<anonymous closure> (dart:async/future_impl.dart:478:11)
E/flutter (10296): #13     SynchronousFuture.then (package:flutter/src/foundation/synchronous_future.dart:41:35)
E/flutter (10296): #14     Future._chainForeignFuture (dart:async/future_impl.dart:474:14)
E/flutter (10296): #15     Future._propagateToListeners (dart:async/future_impl.dart:762:20)
E/flutter (10296): #16     Future._completeWithValue (dart:async/future_impl.dart:539:5)
E/flutter (10296): #17     Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:577:7)
E/flutter (10296): #18     _rootRun (dart:async/zone.dart:1354:13)
E/flutter (10296): #19     _CustomZone.run (dart:async/zone.dart:1258:19)
E/flutter (10296): #20     _CustomZone.runGuarded (dart:async/zone.dart:1162:7)
E/flutter (10296): #21     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1202:23)
E/flutter (10296): #22     _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
E/flutter (10296): #23     _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
E/flutter (10296): 

flutter doctor

[√] Flutter (Channel beta, 1.26.0-17.6.pre, on Microsoft Windows [Version 10.0.18363.1379], locale en-US)
    • Flutter version 1.26.0-17.6.pre at C:\src\flutter
    • Framework revision a29104a69b (7 days ago), 2021-02-16 09:26:56 -0800
    • Engine revision 21fa8bb99e
    • Dart version 2.12.0 (build 2.12.0-259.12.beta)

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at C:\Users\Dev-01\AppData\Local\Android\sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 4.1.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] Connected device (3 available)
    • sdk gphone x86 arm (mobile) • emulator-5554 • android-x86    • Android 11 (API 30) (emulator)
    • Chrome (web)                • chrome        • web-javascript • Google Chrome 88.0.4324.182
    • Edge (web)                  • edge          • web-javascript • Microsoft Edge 88.0.705.68

• No issues found!
@lulupointu
Copy link
Owner

You are right!

I'm fixing this today, I'll close this issue once it's done.

lulupointu added a commit that referenced this issue Feb 23, 2021
@lulupointu
Copy link
Owner

This should be fixed with v1.0.0-nullsafety.8

Please reopen this issue if this does not work for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants