ChangeNotifier is part of flutter:foundation and doesn’t depend on
any higher-level classes in Flutter. It’s easily testable (you don’t even need
to use widget testing for it). For example,
here’s a simple unit test of CartModel:

ChangeNotifierProvider

ChangeNotifierProvider is the widget that provides an instance of
a ChangeNotifier to its descendants. It comes from the provider package.

We already know where to put ChangeNotifierProvider: above the widgets that
need to access it. In the case of CartModel, that means somewhere
above both MyCart and MyCatalog.

You don’t want to place ChangeNotifierProvider higher than necessary
(because you don’t want to pollute the scope). But in our case,
the only widget that is on top of both MyCart and MyCatalog is MyApp.

ChangeNotifierProvider(
      create: (context) => CartModel(),
      child: const MyApp(),
    ),
  );
}