Skip to content

Are global variables bad?

Are global variables bad?

Well, it depends.

In my projects, I often create global variables such as const widgets or Riverpod providers, and there’s nothing wrong with that!

But global MUTABLE state IS dangerous (hard to know who changed it and which widgets should rebuild).

Previous Next
Measuring execution time in Dart Inspecting Network Requests (DevTools)

Last update: 18 septembre 2023
Created: 18 septembre 2023