8.6: AppLink class errata ... constants prefixed with "k"

The AppLink class uses constants prefixed with k which I believe is deprecated. In the next version of the book, I guess there names should be changed.

2 Likes

@jefff9511

Could you please help link an article or how you know it’s deprecated?

I guess it’s not deprecated … it’s just not advised anymore:

If you look in the actual Flutter code, you’ll see it in there. A while back I posted an issue for that Effective Dart: Style page. ('Effective Dart: Style' page issue · Issue #1774 · dart-lang/site-www · GitHub) and there are some comments by the Flutter team.

I do know that when I took the London App Brewery course in May 2019 it also used them.

@spgms @jomoka I think @jefff9511 issue is valid somehow,

In the issue created by @spgms in Github there is a comment by a Flutter team member clearly state that using prefix letters is not idiomatic Dart.

And also in the Flutter style guide wiki, it is stated to use prefix letters only for Global constants:

Begin global constant names with prefix “k”

However, where possible avoid global constants. Rather than kDefaultButtonColor , consider Button.defaultColor . If necessary, consider creating a class with a private constructor to hold relevant constants. It’s not necessary to add the k prefix to non-global constants.

Yes we have corrected it, will be coming in the following updates.

1 Like