Chapter 4 - Adding Stateful Widgets - typo or version difference?

Working with the online copy of Flutter Apprentice, and hit Chapter 4, Adding Stateful Widgets where we convert AuthorCard from Stateless to Stateful by right-clicking and choosing “Convert…”

There seems to be a discrepancy between the code example and the IDE after the conversion.

The code example shows the override as _AuthorCardState createState() => _AuthorCardState(); but the IDE (Android Studio) shows the override as State<AuthorCard> createState() => _AuthorCardState();

Is this a typo, or a possible result of Flutter v2.8 ?

@dionv this might be changes in the latest flutter release!

If you take a look at some of flutter’s old tutorials, they still have the old syntax.

I think both are still correct as _AuthorCardState extends State<AuthorCard>

1 Like