Discussion:
[dart-misc] Dart 2 Core Library Deprecation: SCREAMING CAPS CONSTANTS
'Leaf Petersen' via Dart Misc
2018-03-08 01:16:18 UTC
Permalink
*What's being deprecated?*

Top level constants in the Dart 1 core libraries were named using an all
caps naming convention:

const JsonCodec JSON = const JsonCodec();


This is inconsistent with standard Dart style. In Dart 2, we have
(already) added camel case versions of constants to the library, and we are
now deprecating the old constants.

const JsonCodec json = const JsonCodec();@Deprecated("Use json instead")const JsonCodec JSON = json;


*What will break?*

Nothing, but you may get new deprecation warnings from the analyzer if you
use the old constant names.

info: 'JSON' is deprecated and shouldn't be used. (deprecated_member_use at
scratch.dart:12)

*How do I get rid of the deprecation warnings?*

Use the new constant names (generally just the camel case version of the
old name).

The library documentation
<https://api.dartlang.org/dev/2.0.0-dev.33.0/dart-convert/JSON-constant.html> for
the old name shows the new name to use.

You can also use "go to definition" in the IDE to go to the definition of
the old constant, which references the new name.

*Why is this change being made?*

SCREAMING CAPS ARE INCONSISTENT WITH STANDARD DART STYLE, AND DON'T LOOK
VERY GOOD EITHER.

*When will the old constants go away?*

We hope to remove the old constants in a future release, but because of the
very breaking nature of this change we do not anticipate doing this for the
Dart 2 release. We plan to continue to work towards removal of the old
constants in a future release, possibly with automated tooling to help with
the migration.

This has landed in bleeding edge, and will be released in the next Dart SDK
version (probably 2.0.0-dev.34.0) and rolled into Flutter bleeding edge
shortly thereafter.

As usual, please reach out to me here or offline with any concerns, and/or
with help resolving any issues after this change has landed.

thanks,
-leaf
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
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.
Joe Conway
2018-03-14 03:03:18 UTC
Permalink
I see this landed in dev35(?). Is this same change going to apply to
HttpHeaders, HttpStatus, and ContentType?
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
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.
'Anders Sandholm' via Dart Misc
2018-03-14 09:37:15 UTC
Permalink
Eventually (https://github.com/dart-lang/sdk/issues/31366).
Post by Joe Conway
I see this landed in dev35(?). Is this same change going to apply to
HttpHeaders, HttpStatus, and ContentType?
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
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
--
Anders Sandholm, Product Manager, Dart
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
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.
'Leaf Petersen' via Dart Misc
2018-03-29 23:44:55 UTC
Permalink
TLDR: Please run the dart2_fix
<https://github.com/dart-lang/dart2_fix/blob/master/README.md> tool on your
flutter projects and dart packages *ASAP* to prepare your code for the
removal of the Dart 1 deprecated constants.

Thanks to quick work by Devon Carew to implement tooling to support this
change, we are planning to land the removal of the deprecated Dart 1
constants sometime between Dart Beta 3 (April 12) and Beta 4 (May 15).
This change will roll into flutter sometime after Dart Beta 4 is released.
You can run dart2_fix *right now* to ensure that your code won't break when
this change rolls out.

To upgrade your dart code, you can (and should!) do the following:

Activate the upgrade package:
pub global activate dart2_fix

Run the tool to see what changes will be made:
pub global run dart2_fix

Apply the fixes to your package:
pub global run dart2_fix --apply

Run the analyzer to check for remaining deprecations or new errors:
dartanalyzer --preview-dart-2 .

For flutter projects you can use the flutter command line tool instead
<https://github.com/dart-lang/dart2_fix/blob/master/README.md#what-about-flutter-code>
.

In most cases, the migration tool will eliminate all of the deprecation
warnings from your code. There are a few cases which are not handled by
the tool, and in some (hopefully rare) cases, some subsequent fixup of the
code might be required (usually because of a conflict between a local
variable or field and one of the new constant names).

See the documentation
<https://github.com/dart-lang/dart2_fix/blob/master/README.md> for
dart2_fix for more information and details. And as always, please follow
up here with any problems or issues.

thanks,
-leaf
Post by 'Leaf Petersen' via Dart Misc
*What's being deprecated?*
Top level constants in the Dart 1 core libraries were named using an all
const JsonCodec JSON = const JsonCodec();
This is inconsistent with standard Dart style. In Dart 2, we have
(already) added camel case versions of constants to the library, and we are
now deprecating the old constants.
*What will break?*
Nothing, but you may get new deprecation warnings from the analyzer if you
use the old constant names.
info: 'JSON' is deprecated and shouldn't be used. (deprecated_member_use
at scratch.dart:12)
*How do I get rid of the deprecation warnings?*
Use the new constant names (generally just the camel case version of the
old name).
The library documentation
<https://api.dartlang.org/dev/2.0.0-dev.33.0/dart-convert/JSON-constant.html> for
the old name shows the new name to use.
You can also use "go to definition" in the IDE to go to the definition of
the old constant, which references the new name.
*Why is this change being made?*
SCREAMING CAPS ARE INCONSISTENT WITH STANDARD DART STYLE, AND DON'T LOOK
VERY GOOD EITHER.
*When will the old constants go away?*
We hope to remove the old constants in a future release, but because of
the very breaking nature of this change we do not anticipate doing this for
the Dart 2 release. We plan to continue to work towards removal of the old
constants in a future release, possibly with automated tooling to help with
the migration.
This has landed in bleeding edge, and will be released in the next Dart
SDK version (probably 2.0.0-dev.34.0) and rolled into Flutter bleeding edge
shortly thereafter.
As usual, please reach out to me here or offline with any concerns, and/or
with help resolving any issues after this change has landed.
thanks,
-leaf
--
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/35da5093-3367-4c36-9b5d-de6fb12fb71a%40dartlang.org.
'Leaf Petersen' via Dart Misc
2018-07-18 17:01:15 UTC
Permalink
The patch removing the deprecated constants has landed in bleeding edge,
and will be cherry-picked to dev within the next few days (and subsequently
released as part of Dart 2 stable). If you haven't done so already, please
update your code and ensure that all of your package dependencies have been
updated.

-leaf
Post by 'Leaf Petersen' via Dart Misc
TLDR: Please run the dart2_fix
<https://github.com/dart-lang/dart2_fix/blob/master/README.md> tool on
your flutter projects and dart packages *ASAP* to prepare your code for
the removal of the Dart 1 deprecated constants.
Thanks to quick work by Devon Carew to implement tooling to support this
change, we are planning to land the removal of the deprecated Dart 1
constants sometime between Dart Beta 3 (April 12) and Beta 4 (May 15).
This change will roll into flutter sometime after Dart Beta 4 is released.
You can run dart2_fix *right now* to ensure that your code won't break
when this change rolls out.
pub global activate dart2_fix
pub global run dart2_fix
pub global run dart2_fix --apply
dartanalyzer --preview-dart-2 .
For flutter projects you can use the flutter command line tool instead
<https://github.com/dart-lang/dart2_fix/blob/master/README.md#what-about-flutter-code>
.
In most cases, the migration tool will eliminate all of the deprecation
warnings from your code. There are a few cases which are not handled by
the tool, and in some (hopefully rare) cases, some subsequent fixup of the
code might be required (usually because of a conflict between a local
variable or field and one of the new constant names).
See the documentation
<https://github.com/dart-lang/dart2_fix/blob/master/README.md> for
dart2_fix for more information and details. And as always, please follow
up here with any problems or issues.
thanks,
-leaf
Post by 'Leaf Petersen' via Dart Misc
*What's being deprecated?*
Top level constants in the Dart 1 core libraries were named using an all
const JsonCodec JSON = const JsonCodec();
This is inconsistent with standard Dart style. In Dart 2, we have
(already) added camel case versions of constants to the library, and we are
now deprecating the old constants.
*What will break?*
Nothing, but you may get new deprecation warnings from the analyzer if
you use the old constant names.
info: 'JSON' is deprecated and shouldn't be used. (deprecated_member_use
at scratch.dart:12)
*How do I get rid of the deprecation warnings?*
Use the new constant names (generally just the camel case version of the
old name).
The library documentation
<https://api.dartlang.org/dev/2.0.0-dev.33.0/dart-convert/JSON-constant.html> for
the old name shows the new name to use.
You can also use "go to definition" in the IDE to go to the definition of
the old constant, which references the new name.
*Why is this change being made?*
SCREAMING CAPS ARE INCONSISTENT WITH STANDARD DART STYLE, AND DON'T LOOK
VERY GOOD EITHER.
*When will the old constants go away?*
We hope to remove the old constants in a future release, but because of
the very breaking nature of this change we do not anticipate doing this for
the Dart 2 release. We plan to continue to work towards removal of the old
constants in a future release, possibly with automated tooling to help with
the migration.
This has landed in bleeding edge, and will be released in the next Dart
SDK version (probably 2.0.0-dev.34.0) and rolled into Flutter bleeding edge
shortly thereafter.
As usual, please reach out to me here or offline with any concerns,
and/or with help resolving any issues after this change has landed.
thanks,
-leaf
--
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/20f5433b-ceb3-412c-b5e0-a72f0afd971d%40dartlang.org.
a***@gmail.com
2018-07-19 18:26:19 UTC
Permalink
I would also suggest try using the package dart2_constant as a polyfill
between Dart 1 and Dart 2 API changes for constants.
Post by 'Leaf Petersen' via Dart Misc
The patch removing the deprecated constants has landed in bleeding edge,
and will be cherry-picked to dev within the next few days (and subsequently
released as part of Dart 2 stable). If you haven't done so already, please
update your code and ensure that all of your package dependencies have been
updated.
-leaf
Post by 'Leaf Petersen' via Dart Misc
TLDR: Please run the dart2_fix
<https://github.com/dart-lang/dart2_fix/blob/master/README.md> tool on
your flutter projects and dart packages *ASAP* to prepare your code for
the removal of the Dart 1 deprecated constants.
Thanks to quick work by Devon Carew to implement tooling to support this
change, we are planning to land the removal of the deprecated Dart 1
constants sometime between Dart Beta 3 (April 12) and Beta 4 (May 15).
This change will roll into flutter sometime after Dart Beta 4 is released.
You can run dart2_fix *right now* to ensure that your code won't break
when this change rolls out.
pub global activate dart2_fix
pub global run dart2_fix
pub global run dart2_fix --apply
dartanalyzer --preview-dart-2 .
For flutter projects you can use the flutter command line tool instead
<https://github.com/dart-lang/dart2_fix/blob/master/README.md#what-about-flutter-code>
.
In most cases, the migration tool will eliminate all of the deprecation
warnings from your code. There are a few cases which are not handled by
the tool, and in some (hopefully rare) cases, some subsequent fixup of the
code might be required (usually because of a conflict between a local
variable or field and one of the new constant names).
See the documentation
<https://github.com/dart-lang/dart2_fix/blob/master/README.md> for
dart2_fix for more information and details. And as always, please follow
up here with any problems or issues.
thanks,
-leaf
Post by 'Leaf Petersen' via Dart Misc
*What's being deprecated?*
Top level constants in the Dart 1 core libraries were named using an all
const JsonCodec JSON = const JsonCodec();
This is inconsistent with standard Dart style. In Dart 2, we have
(already) added camel case versions of constants to the library, and we are
now deprecating the old constants.
*What will break?*
Nothing, but you may get new deprecation warnings from the analyzer if
you use the old constant names.
info: 'JSON' is deprecated and shouldn't be used. (deprecated_member_use
at scratch.dart:12)
*How do I get rid of the deprecation warnings?*
Use the new constant names (generally just the camel case version of the
old name).
The library documentation
<https://api.dartlang.org/dev/2.0.0-dev.33.0/dart-convert/JSON-constant.html> for
the old name shows the new name to use.
You can also use "go to definition" in the IDE to go to the definition
of the old constant, which references the new name.
*Why is this change being made?*
SCREAMING CAPS ARE INCONSISTENT WITH STANDARD DART STYLE, AND DON'T LOOK
VERY GOOD EITHER.
*When will the old constants go away?*
We hope to remove the old constants in a future release, but because of
the very breaking nature of this change we do not anticipate doing this for
the Dart 2 release. We plan to continue to work towards removal of the old
constants in a future release, possibly with automated tooling to help with
the migration.
This has landed in bleeding edge, and will be released in the next Dart
SDK version (probably 2.0.0-dev.34.0) and rolled into Flutter bleeding edge
shortly thereafter.
As usual, please reach out to me here or offline with any concerns,
and/or with help resolving any issues after this change has landed.
thanks,
-leaf
--
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/397aad65-e445-480b-930a-629d5ac2fcad%40dartlang.org.
Loading...