Provider function
Implementation
Widget Provider({
String? id,
dynamic store,
Map<String, dynamic>? stores,
required Widget child,
}) {
// store requirement
if (store == null && stores == null) {
throw Exception('Both store and stores can not be null.');
}
String ns = (id ?? '') + (id != null ? '.' : '');
Map<String, dynamic> _providedStores =
store == null ? stores! : {'default': store};
_providedStores.forEach((name, storeObject) {
_stores[ns + name] = storeObject;
try {
storeObject!.stateId = ns + name;
} catch (NoSuchMethodError) {}
});
// print('Provider: ');
// print(_stores);
return child;
}