flutter_clean_architecture icon indicating copy to clipboard operation
flutter_clean_architecture copied to clipboard

Unable to override `initState` on ViewState

Open dcdh opened this issue 3 years ago • 2 comments

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):

  • Version [5.0.0]

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 avatar Dec 26 '21 17:12 dcdh

We should expose _controller to from view.dart.

dcdh avatar Dec 26 '21 18:12 dcdh

Feel free to open a pull request

ShadyBoukhary avatar Jan 25 '22 02:01 ShadyBoukhary

@dcdh just use onInitState replacement life cycle

rafaelcmm avatar Aug 26 '22 13:08 rafaelcmm