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

Error on new Flutter #31

Closed
Bilonik opened this issue Aug 25, 2020 · 12 comments
Closed

Error on new Flutter #31

Bilonik opened this issue Aug 25, 2020 · 12 comments
Labels
good first issue Good for newcomers Published This new feature has been published.

Comments

@Bilonik
Copy link

Bilonik commented Aug 25, 2020

momentum-1.3.1/lib/src/momentum_base.dart:99:18: Error: 'Router' is imported from both 'package:flutter/src/widgets/router.dart' and 'package:momentum/src/momentum_router.dart'.
var result = Router.getParam(_mRootContext);

momentum_base.dart:6:1: Error: 'Router' is imported from both 'package:flutter/src/widgets/router.dart' and 'package:momentum/src/momentum_router.dart'.
import '../momentum.dart';

@xamantra
Copy link
Owner

I need to reproduce this.
What flutter version are using? Is it 1.20.2?

@Bilonik
Copy link
Author

Bilonik commented Aug 25, 2020

Beta Channel Latest : 1.21.0-9.1.pre

@xamantra
Copy link
Owner

I see. I'm working right now. Will check this later.

@xamantra xamantra added the TODO needs to be worked on label Aug 25, 2020
@Bilonik
Copy link
Author

Bilonik commented Aug 25, 2020

Thanks @xamantra

xamantra pushed a commit that referenced this issue Aug 26, 2020
@xamantra
Copy link
Owner

I found the errors and was able to fix them fine. They're just import conflicts so I just use as keyword for importing Router.

Thanks for reporting the issue @Bilonik. I really appreciated it.

I don't know when I can publish version 1.3.2 in pub.dev but for now you can try using the branch dev-1.3.2 from this repository.

dependencies:
  # other packages ...
  momentum:
    git:
      url: https://github.com/xamantra/momentum.git
      ref: dev-1.3.2
  # other packages ...

@xamantra xamantra added FIXED good first issue Good for newcomers RTP Ready to publish and removed TODO needs to be worked on labels Aug 26, 2020
@xamantra xamantra added Published This new feature has been published. and removed RTP Ready to publish labels Oct 13, 2020
@DonnC
Copy link

DonnC commented Jan 7, 2021

@xamantra
This error still persist on flutter 1.22.4 with latest momentum: ^1.3.2
im getting this error:

The name 'Router' is defined in the libraries 'package:flutter/src/widgets/router.dart' and 'package:momentum/src/momentum_router.dart (via package:momentum/momentum.dart)'.
Try using 'as prefix' for one of the import directives, or hiding the name from all but one of the imports.

anyway to fix this without using a bunch of as and show statements in my code?

@xamantra
Copy link
Owner

xamantra commented Jan 7, 2021

You can try the hide keyword. With this, you don't need the as or show keyword anymore.

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

But I probably need to rename the Router class into something else. Like MRouter or MomentumRouter. This is my biggest mistake so far with momentum. I created a dev-1.3.3 branch the other day locally so I might implement this one on the next update.

@xamantra xamantra reopened this Jan 7, 2021
@xamantra xamantra added REOPENED Issue that has been resolved in the past already but appeared again for some reason. TODO needs to be worked on and removed FIXED Published This new feature has been published. labels Jan 7, 2021
@DonnC
Copy link

DonnC commented Jan 7, 2021

thanks for the quick response, a rename to MomentumRouter will do just fine, i mean to me it makes sense. Given that im now used to anything MomentumX -> MomentumService, MomentumController...MomentumRouter sounds good in-order to avoid the default flutter Router which might be confusing sometimes
Will use that quick fix you suggested as i wait for a permanent fix in a new version 🙂

xamantra pushed a commit that referenced this issue Jan 8, 2021
@xamantra
Copy link
Owner

xamantra commented Jan 8, 2021

I renamed the class into MomentumRouter and now you can try using the branch dev-1.3.3 from this repository.

dependencies:
  # other packages ...
  momentum:
    git:
      url: https://github.com/xamantra/momentum.git
      ref: 915a90cb64ec6175e3a3c65879056d186599f1ec
  # other packages ...

This is a GitHub repo link but there shouldn't be any problems with future commits since it's referencing a specific commit not the branch itself.

@xamantra xamantra added RTP Ready to publish and removed TODO needs to be worked on labels Jan 13, 2021
@auric-co
Copy link

When are you releasing the next version with these changes. Now need a stable version to use, than the github repo

@xamantra
Copy link
Owner

Just realized I'm doing the readme rewrite on a different file so merging this on master will be fine. I'll try to release this today.

xamantra pushed a commit that referenced this issue Jan 23, 2021
commit 79ea7c6
Author: xamantra <[email protected]>
Date:   Sun Jan 24 04:09:07 2021 +0800

    firebase core setup

commit c2cdebc
Author: xamantra <[email protected]>
Date:   Sun Jan 24 04:08:15 2021 +0800

    .gitignore: google-services.json

commit a1fa57b
Author: xamantra <[email protected]>
Date:   Mon Jan 11 21:26:07 2021 +0800

    rest api example

commit 0d6dc78
Author: xamantra <[email protected]>
Date:   Mon Jan 11 20:40:46 2021 +0800

    timer example

commit 0de1e53
Author: xamantra <[email protected]>
Date:   Mon Jan 11 20:07:03 2021 +0800

    created example app boilerplate

commit d15ea3f
Author: xamantra <[email protected]>
Date:   Sun Jan 10 06:35:17 2021 +0800

    deprecated some apis and added docs

commit c1137d0
Author: xamantra <[email protected]>
Date:   Sat Jan 9 11:38:32 2021 +0800

    updated readme rewrite

commit be8728b
Author: xamantra <[email protected]>
Date:   Sat Jan 9 09:59:59 2021 +0800

    Restored `Router` class but marked as deprecated #31

commit 915a90c
Author: xamantra <[email protected]>
Date:   Fri Jan 8 09:02:33 2021 +0800

    fixed code coverage

commit cab9c7e
Author: xamantra <[email protected]>
Date:   Fri Jan 8 08:55:42 2021 +0800

    subosito/[email protected]

commit 3216fc5
Author: xamantra <[email protected]>
Date:   Fri Jan 8 08:51:02 2021 +0800

    updated dev ci to dev-1.3.3

commit a3b941a
Author: xamantra <[email protected]>
Date:   Fri Jan 8 08:41:21 2021 +0800

    Renamed `Router` class to `MomentumRouter` #31

commit 5b4d1f6
Author: xamantra <[email protected]>
Date:   Fri Jan 8 06:50:46 2021 +0800

    Modified some docs.
@xamantra
Copy link
Owner

version 1.3.3 is now available on pub.dev
https://pub.dev/packages/momentum/changelog

@xamantra xamantra added Published This new feature has been published. and removed RTP Ready to publish REOPENED Issue that has been resolved in the past already but appeared again for some reason. labels Jan 24, 2021
@xamantra xamantra pinned this issue Jan 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers Published This new feature has been published.
Projects
None yet
Development

No branches or pull requests

4 participants