```dart
StreamSubscription hubSubscription = Amplify.Hub.listen([HubChannel.Auth], (hubEvent) {
  if (hubEvent.eventName == 'SIGNED_OUT') {
    try {
      await Amplify.DataStore.clear();
      print('DataStore is cleared.');
    } on DataStoreException catch (e) {
      print('Failed to clear DataStore: $e');
    }
  }
});
```
