Open SchnMar opened 3 years ago
👋 Hello! Thanks for submitting a issue! @Matt-Gleich will try to respond as soon as possible.
Hello @SchnMar! Mind sending an example file so it easier for me to debug? Thanks!
Hallo @Matt-Gleich,
thank you for your help and sorry for the late reply.
I have the following imports prior to sorting:
// Flutter imports:
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
// Package imports:
// ignore: implementation_imports
import 'package:chewie/src/chewie_player.dart';
// ignore: implementation_imports
import 'package:chewie/src/chewie_progress_colors.dart';
// ignore: implementation_imports
import 'package:chewie/src/cupertino_progress_bar.dart';
// ignore: implementation_imports
import 'package:chewie/src/utils.dart';
import 'package:open_iconic_flutter/open_iconic_flutter.dart';
import 'package:video_player/video_player.dart';
After sorting, the imports appear like this:
// Flutter imports:
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
// Package imports:
import 'package:chewie/src/chewie_player.dart';
import 'package:chewie/src/chewie_progress_colors.dart';
import 'package:chewie/src/cupertino_progress_bar.dart';
import 'package:chewie/src/utils.dart';
import 'package:open_iconic_flutter/open_iconic_flutter.dart';
import 'package:video_player/video_player.dart';
// Package imports:
// ignore: implementation_imports
// ignore: implementation_imports
// ignore: implementation_imports
// ignore: implementation_imports
This leads to me annotating with ```//ignore: implementation_imports after every sort.
What do you think? I'm aware that I shouldn't be doing this, but in this case I think it's reasonable to do so.
I also encounter this issue.
My Dart file:
import 'package:flutter/widgets.dart';
import 'package:easy_localization/easy_localization.dart';
// ignore: implementation_imports
import 'package:easy_localization/src/localization.dart';
import 'package:logging/logging.dart';
import 'l10n.dart';
import_sorter
ignores the //ignore..
statement and messed this up to the following state:
import 'package:flutter/widgets.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:easy_localization/src/localization.dart';
import 'package:logging/logging.dart';
import 'l10n.dart';
// ignore: implementation_imports
A workaround I found is to put // ignore_for_file: implementation_imports
in the file's first line. Then import_sorter
works fine, but it's just a workaround.
See #63
Describe the bug I use // ignore: implementation_imports in my project above some imports because I use some packages and their implementation.
To Reproduce What command or actions did you take to produce this error? I added these comments and ran
flutter pub run import_sorter:main
. Now these comments are listed below all the imports and not above the imports, which actually import implementation from packages.Expected behavior I expected that the comments are sorted with the imports.
Please let me know, if you need additional information. Thank you for your help.