The problem arose when I had a place picker, a list view with item spacing that displayed a list of a widget (widget A), and that widget also had another widget (Widget B) inside. In code, the model for widget A was generated with something like this:
class WidgetAModel
extends FlutterFlowModel<WidgetAWidget> {
/// State fields for stateful widgets in this component.
// Model for widgetB component.
late WidgetBModel widgetBModel1;
@override
void initState(BuildContext context) {
widgetBModel1 =
createModel(context, () => WidgetBModel());
}
@override
void dispose() {
widgetBModel1.dispose();
}
When I used the place picker and then clicked on a button that had goNamed to any other page, an error appeared in the dispose method for widget A, stating that WidgetBModel1 wasn't initialized. But this only happens if I use the place picker. In my opinion, this was a FlutterFlow bug. Anyway, what I did was not use widgetB, but instead placed everything directly in widgetA. This error didn't appear in test mode either, but it did in Android Studio. Likewise, if instead of using goNamed I used pushNamed nothing would happen at first, but if I then used goNamed at some point the error would appear in the dispose method.
LateInitializationError: Field 'widgetBmodel1' has not been initialized.