how to change app theme in runtime in Flutter? how to change app theme in runtime in Flutter? dart dart

how to change app theme in runtime in Flutter?


The load method is returns a Future that will run asynchronously from the rest of your code. When execution reaches debugPrint or the subsequent return statement, you cannot be guaranteed that the then block has completed its execution. The error you are receiving confirms this. The state boolean has not been set to a value yet - it is still null.

Using a FutureBuilder can help you handle cases where you are waiting on a Future to build your widget tree.

https://www.dartlang.org/tutorials/language/futures is worthwhile reading.