blob: 02a36f152bd84986e4291850c41443394c3df5fe [file] [log] [blame]
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "FLTThreadSafeEventChannel.h"
#import "QueueHelper.h"
@interface FLTThreadSafeEventChannel ()
@property(nonatomic, strong) FlutterEventChannel *channel;
@end
@implementation FLTThreadSafeEventChannel
- (instancetype)initWithEventChannel:(FlutterEventChannel *)channel {
self = [super init];
if (self) {
_channel = channel;
}
return self;
}
- (void)setStreamHandler:(NSObject<FlutterStreamHandler> *)handler
completion:(void (^)(void))completion {
[QueueHelper ensureToRunOnMainQueue:^{
[self.channel setStreamHandler:handler];
completion();
}];
}
@end