Let `firstOrNull` extension method wait for `cancel` to complete. (#196)

diff --git a/lib/src/stream_extensions.dart b/lib/src/stream_extensions.dart
index 129ce26..f8a180f 100644
--- a/lib/src/stream_extensions.dart
+++ b/lib/src/stream_extensions.dart
@@ -43,19 +43,15 @@
   /// completed with `null`.
   Future<T?> get firstOrNull {
     var completer = Completer<T?>.sync();
-    final subscription = listen(null);
-    subscription
-      ..onData((event) {
-        subscription.cancel();
+    final subscription = listen(null,
+        onError: completer.completeError,
+        onDone: completer.complete,
+        cancelOnError: true);
+    subscription.onData((event) {
+      subscription.cancel().whenComplete(() {
         completer.complete(event);
-      })
-      ..onError((Object error, StackTrace stackTrace) {
-        subscription.cancel();
-        completer.completeError(error, stackTrace);
-      })
-      ..onDone(() {
-        completer.complete(null);
       });
+    });
     return completer.future;
   }
 }