So, following the ChangeNotifierProxyProvider docs I have implemented the following:
ChangeNotifierProvider<AuthProvider>(
lazy: false,
create: (BuildContext createContext) => AuthProvider(),
),
ChangeNotifierProxyProvider<AuthProvider, APIService>(
create: (_) => APIService(),
update: (_, auth, api) => api..update(auth),
),
This is how it is recommend to implement it in the docs, however i am getting and error:
The return type 'APIService?' isn't a 'APIService', as required by the closure's
context.
Would it be correct to change api..update(auth)
to api!..update(auth)
? Why was this not need in the example provided in the docs.