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

After upgrade to flutter 1.21.0-8.0.pre.110 #214

Closed
daniloadorno opened this issue Aug 8, 2020 · 10 comments · Fixed by #223
Closed

After upgrade to flutter 1.21.0-8.0.pre.110 #214

daniloadorno opened this issue Aug 8, 2020 · 10 comments · Fixed by #223

Comments

@daniloadorno
Copy link

The name 'Router' is defined in the libraries 'package:flutter/src/widgets/router.dart' and 'package:flutter_modular/src/routers/router.dart (via package:flutter_modular/flutter_modular.dart)'.

@lyf571321556
Copy link

flutter doctor -v
✓] Flutter (Channel master, 1.21.0-8.0.pre.177, on Mac OS X 10.15.5 19F101, locale zh-Hans-CN)
• Flutter version 1.21.0-8.0.pre.177 at /Users/liuyanfeng/Library/flutter
• Framework revision 54f21ec7aa (3 hours ago), 2020-08-12 08:01:03 -0400
• Engine revision ccfc7e5179
• Dart version 2.10.0 (build 2.10.0-11.0.dev)
• Pub download mirror https://pub.flutter-io.cn
• Flutter download mirror https://storage.flutter-io.cn

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/liuyanfeng/Library/Android/sdk
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = /Users/liuyanfeng/Library/Android/sdk
• Java binary at: /Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/bin/java
• Java version Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
• All Android licenses accepted.

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

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed
instructions).

[✓] IntelliJ IDEA Ultimate Edition (version 2019.2.3)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin version 42.2.2
• Dart plugin version 192.7761

[!] Proxy Configuration
• HTTP_PROXY is set
! NO_PROXY is not set

[✓] Connected device (3 available)
• iPhone SE (2nd generation) (mobile) • 79557638-7828-42FB-9E79-31EFE2D828E1 • ios
• com.apple.CoreSimulator.SimRuntime.iOS-13-6 (simulator)
• Web Server (web) • web-server •
web-javascript • Flutter Tools
• Chrome (web) • chrome •
web-javascript • Google Chrome 84.0.4147.125

produce some error:

lib/ones_app_module.dart:2:1: Error: 'Router' is imported from both 'package:flutter_modular/src/routers/router.dart' and 'package:flutter/src/widgets/router.dart'.
import 'package:flutter/material.dart';
^^^^^^
../../.pub-cache/hosted/pub.flutter-io.cn/flutter_modular-1.3.2/lib/src/interfaces/child_module.dart:3:1: Error: 'Router' is imported from both 'package:flutter/src/widgets/router.dart' and 'package:flutter_modular/src/routers/router.dart'.
import '../../flutter_modular.dart';
^^^^^^
../../.pub-cache/hosted/pub.flutter-io.cn/flutter_modular-1.3.2/lib/src/modular_base.dart:4:1: Error: 'Router' is imported from both 'package:flutter/src/widgets/router.dart' and 'package:flutter_modular/src/routers/router.dart'.
import '../flutter_modular.dart';
^^^^^^
../../.pub-cache/hosted/pub.flutter-io.cn/flutter_modular-1.3.2/lib/src/widgets/widget_module.dart:2:1: Error: 'Router' is imported from both 'package:flutter/src/widgets/router.dart' and 'package:flutter_modular/src/routers/router.dart'.
import '../../flutter_modular.dart';
^^^^^^
lib/ones_app_module.dart:21:9: Error: 'Router' is imported from both 'package:flutter_modular/src/routers/router.dart' and 'package:flutter/src/widgets/router.dart'.
Router(Modular.initialRoute, child: (, __) => IndexPageWidget()),
^^^^^^
lib/ones_app_module.dart:22:9: Error: 'Router' is imported from both 'package:flutter_modular/src/routers/router.dart' and 'package:flutter/src/widgets/router.dart'.
Router(LoginPage.loginPagePath, child: (
, __) => LoginPage()),
^^^^^^
lib/ones_app_module.dart:23:9: Error: 'Router' is imported from both 'package:flutter_modular/src/routers/router.dart' and 'package:flutter/src/widgets/router.dart'.
Router(HomePageWidget.homePagePath, module: HomeModule()),
^^^^^^
lib/ones_app_module.dart:36:9: Error: 'Router' is imported from both 'package:flutter_modular/src/routers/router.dart' and 'package:flutter/src/widgets/router.dart'.
Router(TaskDetailScene.registerTaskPagePath, child: (_, args) {
^^^^^^
lib/ones_app_module.dart:43:9: Error: 'Router' is imported from both 'package:flutter_modular/src/routers/router.dart' and 'package:flutter/src/widgets/router.dart'.
Router(ProjectComponentListPageWidget.registerComponentListPagePath,
^^^^^^
../../.pub-cache/hosted/pub.flutter-io.cn/flutter_modular-1.3.2/lib/src/modular_base.dart:287:22: Error: The getter 'routerName' isn't defined for the class 'Object'.
- 'Object' is from 'dart:core'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'routerName'.
return preview.routerName.contains('/:') ? 1 : 0;
^^^^^^^^^^

@joaoarmando
Copy link

same here, could you fix it?

@gjstos
Copy link

gjstos commented Aug 13, 2020

Until the situation is resolved, I recommend executing the following command:
flutter downgrade
It will put the flutter in the previous version (1.21.0-7.0.pre) where it was still working.

@jacobaraujo7
Copy link
Contributor

use

import 'package:flutter/material.dart' hide Router;

@muriloventuroso
Copy link

still with error, now inside the modular:

../../../.pub-cache/hosted/pub.dartlang.org/flutter_modular-1.3.2/lib/src/interfaces/child_module.dart:3:1: Error: 'Router' is imported from both 'package:flutter/src/widgets/router.dart' and
'package:flutter_modular/src/routers/router.dart'.
import '../../flutter_modular.dart';
^^^^^^
../../../.pub-cache/hosted/pub.dartlang.org/flutter_modular-1.3.2/lib/src/modular_base.dart:4:1: Error: 'Router' is imported from both 'package:flutter/src/widgets/router.dart' and 'package:flutter_modular/src/routers/router.dart'.
import '../flutter_modular.dart';
^^^^^^
../../../.pub-cache/hosted/pub.dartlang.org/flutter_modular-1.3.2/lib/src/widgets/widget_module.dart:2:1: Error: 'Router' is imported from both 'package:flutter/src/widgets/router.dart' and
'package:flutter_modular/src/routers/router.dart'.
import '../../flutter_modular.dart';
^^^^^^
../../../.pub-cache/hosted/pub.dartlang.org/flutter_modular-1.3.2/lib/src/modular_base.dart:287:22: Error: The getter 'routerName' isn't defined for the class 'Object'.

  • 'Object' is from 'dart:core'.
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'routerName'.
    return preview.routerName.contains('/:') ? 1 : 0;
    ^^^^^^^^^^

@gjstos
Copy link

gjstos commented Aug 18, 2020

@muriloventuroso Now the problem is in the import of material.dart in the modular files.
Just go to the modular files that are showing the errors and put:

import 'package:flutter/material.dart' hide Router;

Just press Crtl + left click in the terminal (or IDE) error that will open the error file.

It was the temporary measure that I took and that is working so far for me.

@muriloventuroso
Copy link

Thank you! I also saw that there is already a pull request to fix this officially.

@phackwer
Copy link

Hi all!

Command bellow replaces all Router calls by ModularRouter easily:

egrep -lRZ 'Router' . | xargs -0 -l sed -i -e 's/Router/ModularRouter/g'

@RodriguesYan
Copy link

RodriguesYan commented Jan 23, 2021

Where do I put this code?

egrep -lRZ 'Router' . | xargs -0 -l sed -i -e 's/Router/ModularRouter/g'

I've tried in VS code terminal and cmd but haven't work.

@Maryblessing
Copy link

Hi all!

Command bellow replaces all Router calls by ModularRouter easily:

egrep -lRZ 'Router' . | xargs -0 -l sed -i -e 's/Router/ModularRouter/g'

Please where do one add this code?

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

Successfully merging a pull request may close this issue.

9 participants