ShadyBoukhary / flutter_clean_architecture

Clean architecture flutter: A Flutter package that makes it easy and intuitive to implement Uncle Bob's Clean Architecture in Flutter. This package provides basic classes that are tuned to work with Flutter and are designed according to the Clean Architecture.
https://pub.dartlang.org/packages/flutter_clean_architecture
MIT License
691 stars 172 forks source link

Unable to override `initState` on ViewState #79

Closed dcdh closed 2 years ago

dcdh commented 2 years ago

Describe the bug I am unable to override initState in ViewState to properlly handle animation.

To Reproduce Steps to reproduce the behavior:

  1. Create an implementation of ViewState likes it is done here https://github.com/ShadyBoukhary/Axion-Technologies-HnH/blob/development/lib/app/pages/splash/splash_view.dart#L24
  2. Override the method initState
  3. This message is displayed: The member 'initState' is declared non-virtual in 'ViewState' and can't be overridden in subclasses.​

Expected behavior I should be able to override initState.

Library (please complete the following information):

Additional context Add any other context about the problem here.

In view.dart on the method initState should not be @nonVirtual. It should be @mustCallSuper.

dcdh commented 2 years ago

We should expose _controller to from view.dart.

ShadyBoukhary commented 2 years ago

Feel free to open a pull request

rafaelcmm commented 2 years ago

@dcdh just use onInitState replacement life cycle