diff --git a/lib/screens/home/cubit/home_cubit.dart b/lib/screens/home/cubit/home_cubit.dart index 1610261..e3906a1 100644 --- a/lib/screens/home/cubit/home_cubit.dart +++ b/lib/screens/home/cubit/home_cubit.dart @@ -96,19 +96,4 @@ class HomeCubit extends Cubit { emit(Paired(device: device)); } } - - /// Unpairs a bonded/paired device. - Future unPairDevice(BluetoothDevice device) async { - _foundedDevices.removeWhere((element) => element.address == device.address); - if (device.isBonded) { - await _bluetooth - .removeDeviceBondWithAddress(device.address) - .then((isUnPairSucessful) { - if (isUnPairSucessful!) { - emit(BluetoothResponse( - message: 'Device ${device.name} has been unpaired!')); - } - }); - } - } } diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index bd2cec1..6a64e9f 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -71,8 +71,6 @@ class HomeScreen extends StatelessWidget { return _CardTile( device: state.devices[i], theme: theme, - onLongPress: () => - event.unPairDevice(state.devices[i]), onPressed: () => event.pairDevice(state.devices[i]), ); }, @@ -125,13 +123,11 @@ class HomeScreen extends StatelessWidget { class _CardTile extends StatelessWidget { final BluetoothDevice device; final void Function() onPressed; - final void Function() onLongPress; const _CardTile({ Key? key, required this.theme, required this.device, required this.onPressed, - required this.onLongPress, }) : super(key: key); final ThemeData theme; @@ -155,7 +151,6 @@ class _CardTile extends StatelessWidget { Text('MAC: ${device.address}', style: theme.textTheme.labelMedium), ], ), - onLongPress: onLongPress, onTap: onPressed, ), );