Discussion:
[dart-misc] [dart-announce] Migrating your packages to Dart 2
'Michael Thomsen' via Dart Announcements
2018-07-20 22:31:39 UTC
Permalink
We expect the Dart 2 release to graduate to stable in the immediate future.
Thus, it’s critical that you migrate your code
<https://www.dartlang.org/dart-2#migration> — especially any packages you
have published — to be Dart 2 compatible now!


There are three main aspects to this:

-

Make sure your code passes Dart 2 analysis (details
<https://www.dartlang.org/dart-2#general-process>). We recommend you
also pay attention to hints — for example, to prepare for deprecations.
-

Run tests to make sure your code passes Dart 2 runtime checks (details
<https://www.dartlang.org/guides/language/sound-problems#runtime-errors>
).
-

Update the upper bound of the SDK constraint of your packages to <3.0.0 (
details
<https://www.dartlang.org/dart-2#upper-constraints-on-the-sdk-version>).


We strongly encourage all package authors to do this work as soon as
possible. To support this work, we’ve made some enhancements to the Pub
site to better show potential issues. See our Medium post
<https://medium.com/dartlang/getting-ready-for-dart-2-and-making-your-packages-look-great-on-the-pub-site-118464d7f59d>
for full details.
--
For more ways to connect visit https://www.dartlang.org/community
---
You received this message because you are subscribed to the Google Groups "Dart Announcements" group.
Visit this group at https://groups.google.com/a/dartlang.org/group/announce/.
--
For more ways to connect visit https://www.dartlang.org/community
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/dfa755b9-cd12-4939-8e12-2172d0a5ba9e%40dartlang.org.
Anatoly Pulyaevskiy
2018-07-23 06:20:15 UTC
Permalink
I have a question.

How do I fix following warnings which only appear in output of `pub
publish`?


Fix lib/src/document/node.dart.
Analysis of lib/src/document/node.dart failed with 2 errors:
line 6 col 8: Target of URI doesn't exist: 'package:meta/meta.dart'.
line 70 col 3: Undefined name 'protected' used as an annotation.


This happens when I import `meta` package and only use annotations from it,
e.g. @protected, like in this case.
Running dartanalyzer results on "no issues found".

Link to the source code for
reference: https://github.com/memspace/zefyr/blob/master/packages/notus/lib/src/document/node.dart
Package: https://pub.dartlang.org/packages/notus#-analysis-tab-

Another issue is that analysis tab says I should add `strong-mode: true` to
my analysis_options.yaml, but dartanalyzer says it's deprecated.

Thanks,
Anatoly


On Friday, July 20, 2018 at 3:31:44 PM UTC-7, 'Michael Thomsen' via Dart
Post by 'Michael Thomsen' via Dart Announcements
We expect the Dart 2 release to graduate to stable in the immediate
future. Thus, it’s critical that you migrate your code
<https://www.dartlang.org/dart-2#migration> — especially any packages you
have published — to be Dart 2 compatible now!
-
Make sure your code passes Dart 2 analysis (details
<https://www.dartlang.org/dart-2#general-process>). We recommend you
also pay attention to hints — for example, to prepare for deprecations.
-
Run tests to make sure your code passes Dart 2 runtime checks (details
<https://www.dartlang.org/guides/language/sound-problems#runtime-errors>
).
-
Update the upper bound of the SDK constraint of your packages to <3.0.0
(details
<https://www.dartlang.org/dart-2#upper-constraints-on-the-sdk-version>
).
We strongly encourage all package authors to do this work as soon as
possible. To support this work, we’ve made some enhancements to the Pub
site to better show potential issues. See our Medium post
<https://medium.com/dartlang/getting-ready-for-dart-2-and-making-your-packages-look-great-on-the-pub-site-118464d7f59d>
for full details.
--
For more ways to connect visit https://www.dartlang.org/community
---
You received this message because you are subscribed to the Google Groups
"Dart Announcements" group.
Visit this group at
https://groups.google.com/a/dartlang.org/group/announce/.
--
For more ways to connect visit https://www.dartlang.org/community
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/709adf61-f9a8-476f-998b-af76f83d89af%40dartlang.org.
Istvan Soos
2018-07-23 07:13:20 UTC
Permalink
On Mon, Jul 23, 2018 at 8:20 AM, Anatoly Pulyaevskiy
Post by Anatoly Pulyaevskiy
How do I fix following warnings which only appear in output of `pub
publish`?
You can abort the publish at that point and fix the warnings from the
console. If you are looking to fix pub site's warnings, there is a
tool called pana, which you can run locally, and should give you most
of the output that you find on pub site (in a json format):
https://pub.dartlang.org/packages/pana
Post by Anatoly Pulyaevskiy
Fix lib/src/document/node.dart.
line 6 col 8: Target of URI doesn't exist: 'package:meta/meta.dart'.
line 70 col 3: Undefined name 'protected' used as an annotation.
Your code depends on package:meta, but it does not specify it as a
dependency (only through transitive dev_dependencies). During pub
site's analysis we remove the dev_dependencies and work only with your
dependencies block, and pub is not able to resolve the package. As
your library code depends on it, you shall specify it as a dependency
(although pub site's analysis is a bit forgiving there, it will work
if it is pulled in as a transitive dependency too).
Post by Anatoly Pulyaevskiy
Another issue is that analysis tab says I should add `strong-mode: true` to
my analysis_options.yaml, but dartanalyzer says it's deprecated.
Fix is in progress for that.

Thanks,
Istvan
--
For more ways to connect visit https://www.dartlang.org/community
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/CALdQGgt1rkq2G0Ta3PbHK3K5JOZNZa0H4si%2Bo3Mkhox67Cga3g%40mail.gmail.com.
Anatoly Pulyaevskiy
2018-07-23 16:47:39 UTC
Permalink
Thanks Istvan,

Looks like all this time I've been reading it wrong, user error. When Pub
prints out following message:

Suggestions:
* line 6, column 1 of lib/src/document/node.dart: This package doesn't
depend on meta.
import 'package:meta/meta.dart';
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

For some reason I always thought that it thinks my
lib/src/document/node.dart imports meta but is not using it, kind of like
similar analyzer warning about "unused import".
With your explanation it's now clear what I've been doing wrong.

This is probably only me but I think wording in this suggestion could be
improved to something like "This package imports meta but does not have it
listed in dependencies section."

Also this sounds more like a "warning" than "suggestion" to me. I'm
surprised Pub allows me to publish my packages in such state.
Post by Istvan Soos
On Mon, Jul 23, 2018 at 8:20 AM, Anatoly Pulyaevskiy
Post by Anatoly Pulyaevskiy
How do I fix following warnings which only appear in output of `pub
publish`?
You can abort the publish at that point and fix the warnings from the
console. If you are looking to fix pub site's warnings, there is a
tool called pana, which you can run locally, and should give you most
https://pub.dartlang.org/packages/pana
Post by Anatoly Pulyaevskiy
Fix lib/src/document/node.dart.
line 6 col 8: Target of URI doesn't exist: 'package:meta/meta.dart'.
line 70 col 3: Undefined name 'protected' used as an annotation.
Your code depends on package:meta, but it does not specify it as a
dependency (only through transitive dev_dependencies). During pub
site's analysis we remove the dev_dependencies and work only with your
dependencies block, and pub is not able to resolve the package. As
your library code depends on it, you shall specify it as a dependency
(although pub site's analysis is a bit forgiving there, it will work
if it is pulled in as a transitive dependency too).
Post by Anatoly Pulyaevskiy
Another issue is that analysis tab says I should add `strong-mode: true`
to
Post by Anatoly Pulyaevskiy
my analysis_options.yaml, but dartanalyzer says it's deprecated.
Fix is in progress for that.
Thanks,
Istvan
--
For more ways to connect visit https://www.dartlang.org/community
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/9788ebfe-5b3b-4c65-b76d-8ce30d92a8d7%40dartlang.org.
Rob Becker
2018-07-23 18:38:30 UTC
Permalink
To check your dependencies, you can
use https://pub.dartlang.org/packages/dependency_validator
Post by Anatoly Pulyaevskiy
Thanks Istvan,
Looks like all this time I've been reading it wrong, user error. When Pub
* line 6, column 1 of lib/src/document/node.dart: This package doesn't
depend on meta.
import 'package:meta/meta.dart';
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
For some reason I always thought that it thinks my
lib/src/document/node.dart imports meta but is not using it, kind of like
similar analyzer warning about "unused import".
With your explanation it's now clear what I've been doing wrong.
This is probably only me but I think wording in this suggestion could be
improved to something like "This package imports meta but does not have it
listed in dependencies section."
Also this sounds more like a "warning" than "suggestion" to me. I'm
surprised Pub allows me to publish my packages in such state.
Post by Istvan Soos
On Mon, Jul 23, 2018 at 8:20 AM, Anatoly Pulyaevskiy
Post by Anatoly Pulyaevskiy
How do I fix following warnings which only appear in output of `pub
publish`?
You can abort the publish at that point and fix the warnings from the
console. If you are looking to fix pub site's warnings, there is a
tool called pana, which you can run locally, and should give you most
https://pub.dartlang.org/packages/pana
Post by Anatoly Pulyaevskiy
Fix lib/src/document/node.dart.
line 6 col 8: Target of URI doesn't exist: 'package:meta/meta.dart'.
line 70 col 3: Undefined name 'protected' used as an annotation.
Your code depends on package:meta, but it does not specify it as a
dependency (only through transitive dev_dependencies). During pub
site's analysis we remove the dev_dependencies and work only with your
dependencies block, and pub is not able to resolve the package. As
your library code depends on it, you shall specify it as a dependency
(although pub site's analysis is a bit forgiving there, it will work
if it is pulled in as a transitive dependency too).
true` to
Post by Anatoly Pulyaevskiy
my analysis_options.yaml, but dartanalyzer says it's deprecated.
Fix is in progress for that.
Thanks,
Istvan
--
For more ways to connect visit https://www.dartlang.org/community
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/c1cfe948-d207-41ac-b49c-6a3cec221e9b%40dartlang.org.
'Kevin Moore' via Dart Announcements
2018-07-25 20:50:28 UTC
Permalink
This post might be inappropriate. Click to display it.
Loading...