@@ -47,57 +47,57 @@ protocol _FlutterBinaryMessengerConnectionRepresentable: FlutterChannel {
4747
4848private let kControlChannelName = " dev.flutter/channel-buffers "
4949
50- public extension FlutterChannel {
51- private static func _controlChannelBuffers(
52- binaryMessenger: FlutterBinaryMessenger ,
53- on channel: String ,
54- method: String ,
55- _ arg: AnyFlutterStandardCodable
56- ) async throws {
57- let codec = FlutterStandardMessageCodec . shared
58- let arguments : [ AnyFlutterStandardCodable ] = [ AnyFlutterStandardCodable . string ( channel) , arg]
59- let methodCall = FlutterMethodCall < [ AnyFlutterStandardCodable ] > (
60- method: method,
61- arguments: arguments
62- )
63- try await binaryMessenger. send (
64- on: kControlChannelName,
65- message: codec. encode ( methodCall)
66- )
67- }
50+ private func _controlChannelBuffers(
51+ binaryMessenger: FlutterBinaryMessenger ,
52+ on channel: String ,
53+ method: String ,
54+ _ arg: AnyFlutterStandardCodable
55+ ) async throws {
56+ let codec = FlutterStandardMessageCodec . shared
57+ let arguments : [ AnyFlutterStandardCodable ] = [ AnyFlutterStandardCodable . string ( channel) , arg]
58+ let methodCall = FlutterMethodCall < [ AnyFlutterStandardCodable ] > (
59+ method: method,
60+ arguments: arguments
61+ )
62+ try await binaryMessenger. send (
63+ on: kControlChannelName,
64+ message: codec. encode ( methodCall)
65+ )
66+ }
6867
69- private static func resizeChannelBuffer (
70- binaryMessenger: FlutterBinaryMessenger ,
71- on channel: String ,
72- newSize: Int
73- ) async throws {
74- try await _controlChannelBuffers (
75- binaryMessenger: binaryMessenger,
76- on: channel,
77- method: " resize " ,
78- AnyFlutterStandardCodable . int32 ( Int32 ( newSize) )
79- )
80- }
68+ func _resizeChannelBuffer (
69+ binaryMessenger: FlutterBinaryMessenger ,
70+ on channel: String ,
71+ newSize: Int
72+ ) async throws {
73+ try await _controlChannelBuffers (
74+ binaryMessenger: binaryMessenger,
75+ on: channel,
76+ method: " resize " ,
77+ AnyFlutterStandardCodable . int32 ( Int32 ( newSize) )
78+ )
79+ }
8180
82- func resizeChannelBuffer( _ newSize: Int ) async throws {
83- try await Self . resizeChannelBuffer ( binaryMessenger: binaryMessenger, on: name, newSize: newSize)
84- }
81+ func _allowChannelBufferOverflow(
82+ binaryMessenger: FlutterBinaryMessenger ,
83+ on channel: String ,
84+ allowed: Bool
85+ ) async throws {
86+ try await _controlChannelBuffers (
87+ binaryMessenger: binaryMessenger,
88+ on: channel,
89+ method: " overflow " ,
90+ allowed ? AnyFlutterStandardCodable . true : AnyFlutterStandardCodable . false
91+ )
92+ }
8593
86- private static func allowChannelBufferOverflow(
87- binaryMessenger: FlutterBinaryMessenger ,
88- on channel: String ,
89- allowed: Bool
90- ) async throws {
91- try await _controlChannelBuffers (
92- binaryMessenger: binaryMessenger,
93- on: channel,
94- method: " overflow " ,
95- allowed ? AnyFlutterStandardCodable . true : AnyFlutterStandardCodable . false
96- )
94+ public extension FlutterChannel {
95+ func resizeChannelBuffer( _ newSize: Int ) async throws {
96+ try await _resizeChannelBuffer ( binaryMessenger: binaryMessenger, on: name, newSize: newSize)
9797 }
9898
9999 func allowChannelBufferOverflow( _ allowed: Bool ) async throws {
100- try await Self . allowChannelBufferOverflow (
100+ try await _allowChannelBufferOverflow (
101101 binaryMessenger: binaryMessenger,
102102 on: name,
103103 allowed: allowed
0 commit comments