refreshGattCache method

  1. @override
Future<void> refreshGattCache({
  1. required String deviceAddress,
})
override

Clears the Android GATT cache for the connected device by invoking the hidden BluetoothGatt.refresh() method via reflection on the native side.

On iOS, this call returns immediately without performing any platform action because Core Bluetooth does not expose a GATT cache.

Throws a GattCacheException if the native reflective call fails.

Implementation

@override
Future<void> refreshGattCache({required String deviceAddress}) async {
  try {
    await channel.invokeMethod<void>(
      'refreshGattCache',
      {'address': deviceAddress},
    );
  } on PlatformException catch (e) {
    throw GattCacheException(
      'Failed to refresh GATT cache for $deviceAddress: ${e.message}',
    );
  }
}