Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/src/data_stream/stream_writer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import '../utils.dart';

class BaseStreamWriter<T, InfoType extends BaseStreamInfo> {
final StreamWriter<T> writableStream;
Function()? onClose;
Future<void> Function()? onClose;

final InfoType info;

Expand All @@ -23,7 +23,7 @@ class BaseStreamWriter<T, InfoType extends BaseStreamInfo> {

Future<void> close() async {
await writableStream.close();
onClose?.call();
await onClose?.call();
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/src/managers/event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ abstract class EventsListenable<T> extends Disposable {
// cast to E
await then(event);
// cancel after 1 event
cancelFunc?.call();
await cancelFunc?.call();
});
return cancelFunc;
}
Expand Down
12 changes: 2 additions & 10 deletions lib/src/participant/local.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1218,13 +1218,7 @@ extension DataStreamParticipantMethods on LocalParticipant {

final cancelFun = room.engine.events.once<EngineClosingEvent>((_) => onEngineClose);

final writer = TextStreamWriter(
writableStream: writableStream,
info: info,
onClose: () {
cancelFun?.call();
},
);
final writer = TextStreamWriter(writableStream: writableStream, info: info, onClose: cancelFun);

return writer;
}
Expand Down Expand Up @@ -1320,9 +1314,7 @@ extension DataStreamParticipantMethods on LocalParticipant {
final byteWriter = ByteStreamWriter(
writableStream: writableStream,
info: info,
onClose: () {
cancelFun?.call();
},
onClose: cancelFun,
);

return byteWriter;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/preconnect/pre_connect_audio_buffer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class PreConnectAudioBuffer {
Future<void> reset() async {
await stopRecording();
_timeoutTimer?.cancel();
_participantStateListener?.call();
await _participantStateListener?.call();
_participantStateListener = null;
_buffer.clear();

Expand Down
2 changes: 1 addition & 1 deletion lib/src/types/other.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import 'package:flutter/material.dart';
import '../extensions.dart';
import '../participant/participant.dart';

typedef CancelListenFunc = Function();
typedef CancelListenFunc = Future<void> Function();

/// Protocol version to use when connecting to server.
/// Usually it's not recommended to change this.
Expand Down
2 changes: 1 addition & 1 deletion test/core/room_e2e_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void main() {
await room.events.waitFor<ParticipantConnectedEvent>(duration: const Duration(seconds: 1));

// Clean up listener
cancel();
await cancel();

// Verify participant had tracks when connected event was emitted
expect(participantHadTracksOnConnect, isTrue,
Expand Down