jeudi 16 mai 2019

No context in callback from custom widget

I'm new to Flutter so this is probably easily answered by someone with more experience than me. It's more of a question about design than a code problem.

Sometimes I want to write re-usable widgets and to make them somewhat generic I want to have callbacks for user input, so that the parent widget can subscribe and then take proper actions rather than hard coding routes etc. But I directly run into trouble if I for instance wants to navigate from my callback, as I then have no context. So how do I design this in Flutter?

Aucun commentaire:

Enregistrer un commentaire