hasRepository<T extends CoreRepository> method

bool hasRepository<T extends CoreRepository>()

Checks if a repository type is available.

Type Parameters:

  • T: The repository type to check

Returns:

  • bool: true if a repository of this type is registered, false otherwise

Example:

if (AdapterRegistry().hasRepository<PushNotificationRepository>()) {
  final notificationRepo = AdapterRegistry().getRepository<PushNotificationRepository>();
  await notificationRepo.requestPermission();
} else {
  print('Push notifications not available');
}

Implementation

bool hasRepository<T extends CoreRepository>() {
  return _repositories.containsKey(T);
}