nylo-core / nylo

Nylo is the fastest way to build your next Flutter mobile app. Streamline your projects with Nylo's opinionated approach to building Flutter apps. Develop your next idea ⚡️
https://nylo.dev
MIT License
597 stars 61 forks source link

State management in page #142

Closed tayfunuyar closed 5 months ago

tayfunuyar commented 5 months ago

Hi guys, How to update current state in page. stateUpdate not working in the page

I give sample code update currency in current page state with setState why isn't working.

class ItemDetailPage
    extends NyStatefulWidget<ItemDetailController> {
  static const path = '/item-detail-page';
  static const stateName = "item-page-state";

  ItemDetailPage({super.key})
      : super(path, child: ItemDetailPageState());
}
class ItemDetailPageState
    extends NyState<ItemDetailPage> {
 String currency= 'EUR';

  ItemDetailPageState() {
    stateName = ItemDetailPage.stateName;
  }
  @override
  Widget view(BuildContext context) {
}
}
agordn52 commented 5 months ago

Hi @tayfunuyar,

In your pubspec.yaml file, which version of nylo_framework are you using?

tayfunuyar commented 5 months ago

Hi @agordn52
nylo_framework: ^5.27.2

agordn52 commented 5 months ago

Ok great, try this https://nylo.dev/docs/5.20.0/state-management#updating-a-state

You can check out the full docs on https://nylo.dev or you can watch this video on state management in Nylo https://www.youtube.com/watch?v=X5EVh1KooFk

agordn52 commented 5 months ago

Hi @tayfunuyar,

Try using the latest version of the nylo_framework and follow our documentation to help you understand how State Management works in Nylo.

tayfunuyar commented 5 months ago

Thanks @agordn52