addressSuggestionsFamily top-level property

FutureProviderFamily<List<DeviceAddress>, String> addressSuggestionsFamily
final

Provides address suggestions for a given search term.

Implementation

final addressSuggestionsFamily =
    FutureProvider.family<List<DeviceAddress>, String>((ref, search) async {
  if (search.length < 3) return [];

  return ref
      .watch(energyManagementV3ApiProvider.future)
      .then((api) => api.kemApiV3DevicesAddressGet(address: search))
      .then(responseToValue)
      .then((suggestions) => suggestions.map(dtoToDeviceAddress).toList());
});