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

flutter upgrade dcdg #62

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

flutter upgrade dcdg #62

wants to merge 2 commits into from

Conversation

gonojuarez
Copy link

upgrade analyzer to 4.7.0

upgrade analyzer to 4.7.0
dependencies:
  analyzer: ^4.7.0
  args: ^2.3.1
  path: ^1.8.2

dev_dependencies:
  lints: ^2.0.1
  test: ^1.21.6
@@ -338,4 +331,4 @@ packages:
source: hosted
version: "3.1.0"
sdks:
dart: ">=2.14.0 <3.0.0"
dart: ">=2.18.0 <3.0.0"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to be backward compatible as far as possible. There are users who are still on older versions of Dart.

Copy link
Author

@gonojuarez gonojuarez Oct 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put an example :
Mockito is incompatible with your library.
If you need to make unit testing with mock your library is invalid.
That's the reason I suggested these changes.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mockito supports Dart 2.17, see https://github.com/dart-lang/mockito/blob/master/pubspec.yaml#L9, so, at the very least, we can lower adjust the lower bound here.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also globally activate DCDG, you don't need to have it in your dependencies.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm missing something but why not keep your package up to date? If someone needs to run an older version to support their project, they can activate an older version.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I want the latest version to work with as many versions of Dart as possible.

Copy link

@nicholasspencer nicholasspencer Mar 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that, sort of, but it seems like your desire to support older versions is going to make your tool useless with newer versions of dart with new language constructs and new versions of the analyzer 🤷. Again, just in case you weren't aware... you can activate packages with version constraints.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to use this library on a project running the latest versions of Flutter and Dart and I'm facing the problem that this PR would solve.

Copy link

@msp98 msp98 Apr 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rexobias I activated the global package using dart pub global activate -sgit https://github.com/gonojuarez/dcdg.dart
But it's still giving me the below error

╰─ dcdg .                                                                                                                           ─╯
Unhandled exception:
Null check operator used on a null value
#0      ElementAnnotationExtensions.targetKinds (package:analyzer/src/dart/element/extensions.dart:42:51)
#1      BestPracticesVerifier.visitAnnotation (package:analyzer/src/error/best_practices_verifier.dart:323:25)
#2      AnnotationImpl.accept (package:analyzer/src/dart/ast/ast.dart:318:50)
#3      NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:8777:20)
#4      AnnotatedNodeImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:154:17)
#5      ClassDeclarationImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1823:11)
#6      RecursiveAstVisitor.visitClassDeclaration (package:analyzer/dart/ast/visitor.dart:793:10)
#7      BestPracticesVerifier.visitClassDeclaration (package:analyzer/src/error/best_practices_verifier.dart:404:13)
#8      ClassDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:1799:50)
#9      NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:8777:20)
#10     CompilationUnitImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:2455:21)
#11     RecursiveAstVisitor.visitCompilationUnit (package:analyzer/dart/ast/visitor.dart:817:10)
#12     CompilationUnitImpl.accept (package:analyzer/src/dart/ast/ast.dart:2448:50)
#13     LibraryAnalyzer._computeHints (package:analyzer/src/dart/analysis/library_analyzer.dart:344:10)
#14     LibraryAnalyzer._computeDiagnostics.<anonymous closure> (package:analyzer/src/dart/analysis/library_analyzer.dart:274:9)
#15     _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:633:13)
#16     LibraryAnalyzer._computeDiagnostics (package:analyzer/src/dart/analysis/library_analyzer.dart:273:13)
#17     LibraryAnalyzer.analyze (package:analyzer/src/dart/analysis/library_analyzer.dart:92:5)
#18     AnalysisDriver._computeAnalysisResult.<anonymous closure> (package:analyzer/src/dart/analysis/driver.dart:1373:11)
<asynchronous suspension>
#19     PerformanceLog.runAsync (package:analyzer/src/dart/analysis/performance_logger.dart:50:14)
<asynchronous suspension>
#20     AnalysisDriver.performWork (package:analyzer/src/dart/analysis/driver.dart:1081:24)
<asynchronous suspension>
#21     AnalysisDriverScheduler._run (package:analyzer/src/dart/analysis/driver.dart:2171:7)
<asynchronous suspension>

#0      AnalysisDriver._computeAnalysisResult.<anonymous closure> (package:analyzer/src/dart/analysis/driver.dart:1402:9)
<asynchronous suspension>
#1      PerformanceLog.runAsync (package:analyzer/src/dart/analysis/performance_logger.dart:50:14)
<asynchronous suspension>
#2      AnalysisDriver.performWork (package:analyzer/src/dart/analysis/driver.dart:1081:24)
<asynchronous suspension>
#3      AnalysisDriverScheduler._run (package:analyzer/src/dart/analysis/driver.dart:2171:7)
<asynchronous suspension>

How did you get this working?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to be backward compatible as far as possible. There are users who are still on older versions of Dart.

That is a strange motivation to make your package unusable to everyone but developers with old versions of Dart, who have need and time to upgrade to latest dcdg instead of upgrading their old Dart dependencies.

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 this pull request may close these issues.

6 participants