Line data Source code
1 : import 'package:flutter/foundation.dart'; 2 : import 'package:flutter/services.dart'; 3 : 4 : @immutable 5 : abstract class IsolateEvent { 6 5 : const IsolateEvent(); 7 : } 8 : 9 : /// Event to invoke [MethodChannel] in main isolate. 10 : @immutable 11 : class InvokePlatformChannelEvent extends IsolateEvent { 12 5 : const InvokePlatformChannelEvent(this.data, this.channel, this.id); 13 : 14 : final ByteData? data; 15 : final String channel; 16 : final String id; 17 : } 18 : 19 : /// Event with response from [MethodChannel] 20 : @immutable 21 : class PlatformChannelResponseEvent extends IsolateEvent { 22 5 : const PlatformChannelResponseEvent(this.data, this.id); 23 : 24 : final ByteData? data; 25 : final String id; 26 : } 27 : 28 : /// Event to invoke [MethodChannel.setMethodCallHandler] in [IsolateBloc]'s isolate. 29 : @immutable 30 : class InvokeMethodChannelEvent extends IsolateEvent { 31 5 : const InvokeMethodChannelEvent(this.data, this.channel, this.id); 32 : 33 : final ByteData? data; 34 : final String channel; 35 : final String id; 36 : } 37 : 38 : /// Event with response from [MethodChannel.setMethodCallHandler] in [IsolateBloc]'s isolate. 39 : @immutable 40 : class MethodChannelResponseEvent extends IsolateEvent { 41 5 : const MethodChannelResponseEvent(this.data, this.id); 42 : 43 : final ByteData? data; 44 : final String id; 45 : }