Skip to content

Commit

Permalink
Fix useMessageListener parameters (#47)
Browse files Browse the repository at this point in the history
You had to pass empty onInitialMessage to pass the keys to the
useMessageListener hook, now onInitialMessage and keys will be named.

* Bump comms

* Update CHANGELOG and pubspec

* Change optional useMessageListener parameters to named
  • Loading branch information
lewandowski-jan authored Feb 7, 2023
1 parent 42cdc88 commit 53de015
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions packages/flutter_comms/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.0.5

- **Breaking:** Change `useMessageListener`s `onInitialMessage` and `keys` to named parameters (#47)

## 0.0.4+1

- Upgrade comms package
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter_comms/lib/src/use_message_listener.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import 'package:flutter_hooks/flutter_hooks.dart';
/// Works similarly to [Listener] but handles starting receiving messages and
/// cleaning up itself.
void useMessageListener<Message>(
OnMessage<Message> onMessage, [
OnMessage<Message> onMessage, {
OnMessage<Message>? onInitialMessage,
List<Object?> keys = const <Object>[],
]) {
}) {
use(
_MessageListenerHook<Message>(
onMessage: onMessage,
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter_comms/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_comms
description: Simple communication pattern abstraction on streams, created for communication between blocs and or widgets.
version: 0.0.4+1
version: 0.0.5
homepage: https://github.com/leancodepl/comms

environment:
Expand All @@ -9,7 +9,7 @@ environment:

dependencies:
bloc: ^8.1.0
comms: ^0.0.8+1
comms: ^0.0.8+2
flutter:
sdk: flutter
flutter_hooks: ^0.18.2
Expand Down

0 comments on commit 53de015

Please sign in to comment.