mardi 24 décembre 2019

How to make dependOnInheritedWidgetOfExactType work with flutter build web?

I am using dependOnInheritedWidgetOfExactType and it works for iOS and web (when developing) but, strangely, when I run flutter build web it doesn't work anymore (in the built web).

I do something like this in my child widget:

  @override
  void didChangeDependencies() {
    super.didChangeDependencies();
    ServicesWidget services = context.dependOnInheritedWidgetOfExactType<ServicesWidget>();
    _usersRepository = services.usersRepository;
    loadUsers();
  }

I've seen that it's exactly that call to dependOnInheritedWidgetOfExactType what silently crashes in the built web. It doesn't throw any error or message in the browser console.

And, as I said, it works for web when developing. So I have no clue of what's going on... :(




Aucun commentaire:

Enregistrer un commentaire