Flutter

Context in initstate()

41 views 1 comments

User Profile Picture

Seamus Armhand

2 weeks ago

I have an app which takes in a URL from a qrcode and is added to provider model.

I have socketio client connection in initstate() of a home page.

If a hard coded URL string is used in initstate() everything is fine and dandy.

If the provider value is used then the socketio is not working.

I've tried WidgetsBinding.instance.addPostFrameCallback((_).

and Future.delayed(Duration.zero).then((_) but no joy.

Any ideas

User Profile Picture

Seamus Armhand

1 week ago

A simple answer the URL variable is passed to the home page and then used in initstate.