Skip to content

Duplicate // Flutter imports: #55

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

Open
hoc081098 opened this issue Jun 15, 2021 · 12 comments
Open

Duplicate // Flutter imports: #55

hoc081098 opened this issue Jun 15, 2021 · 12 comments
Labels
bug Something isn't working

Comments

@hoc081098
Copy link

IMO, should remove // Flutter imports / // Project imports: / ... before sorting

@hoc081098 hoc081098 added the bug Something isn't working label Jun 15, 2021
@gleich
Copy link
Member

gleich commented Jun 15, 2021

@hoc081098 hello! Would you mind giving some more info on this? I'm not super sure what you mean here.

@gleich
Copy link
Member

gleich commented Jun 15, 2021

If there really is a duplicate // Flutter imports: would you mind giving me an example file that this is happening for? It would help a lot in the debugging process.

@hoc081098
Copy link
Author

@gleich Like this
image

@hoc081098
Copy link
Author

And
image

@hoc081098
Copy link
Author

@gleich I have just meet it again!

import_sorter: ^4.6.0

image

@gleich
Copy link
Member

gleich commented Jun 19, 2021

Hmm, this is a strange one. Mind sending the actual file so I could test it locally? Thanks!

@georgeherby
Copy link

I am getting this too. If the Flutter Imports header is present with no imports under it but there are flutter imports in the imports when i run the import_sorter it adds it in again. As they were just under the wrong under the header in the original and now it has two headers.
image

@georgeherby
Copy link

That does not seem to be the only case just ran it again it just randomly added the Flutter imports again
image

@gleich
Copy link
Member

gleich commented Jun 28, 2021

@georgeherby would you please mind sending me the file in that screenshot so I can test it locally? Thanks!

@georgeherby
Copy link

georgeherby commented Jun 30, 2021

@gleich a bit tricky as it does not happen all the time. However, I edited a file so its imports looked like this and it seems to happen every time.

// 🐦 Flutter imports:

// 📦 Package imports:
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:html/dom.dart' as dom;
import 'package:url_launcher/url_launcher.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

// 🌎 Project imports:
import 'package:crypto_app/core/bloc/appsettings/appsettings_bloc.dart';
import 'package:crypto_app/core/bloc/asset_overview/asset_overview_bloc.dart';

by moving the flutter imports to the package imports block. I ran flutter pub run import_sorter:main version 4.6.0 on flutter stable 2.2.2 and it ended up like:

// 🐦 Flutter imports:

// 🐦 Flutter imports:
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

// 📦 Package imports:
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:html/dom.dart' as dom;
import 'package:url_launcher/url_launcher.dart';

// 🌎 Project imports:
import 'package:crypto_app/core/bloc/appsettings/appsettings_bloc.dart';
import 'package:crypto_app/core/bloc/asset_overview/asset_overview_bloc.dart';

I can't really sure the rest of the file so hope that is fine.

@hongfeiyang
Copy link

Same for me

@gleich
Copy link
Member

gleich commented Dec 7, 2021

See #63

@gleich gleich closed this as completed Dec 7, 2021
@gleich gleich reopened this Dec 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants