quickActionColorProvider top-level property

FutureProviderFamily<Map<String, Color?>, DictionaryHeading> quickActionColorProvider
final

Provides color for all quick actions.

Implementation

final quickActionColorProvider =
    FutureProvider.family<Map<String, Color?>, DictionaryHeading>(
        (ref, heading) async {
  AppModel appModel = ref.watch(appProvider);
  List<Future<Color?>> futures = appModel.quickActions.values.map((e) async {
    return e.getIconColor(
      appModel: appModel,
      heading: heading,
    );
  }).toList();

  List<Color?> colors = await Future.wait(futures);
  return Map<String, Color?>.fromEntries(
      appModel.quickActions.values.mapIndexed((i, action) {
    return MapEntry(action.uniqueKey, colors[i]);
  }));
});