@@ -383,6 +383,10 @@ impl FlutterEngine {
383
383
}
384
384
385
385
pub fn send_window_metrics_event ( & self , width : usize , height : usize , pixel_ratio : f64 ) {
386
+ if !self . is_platform_thread ( ) {
387
+ panic ! ( "Not on platform thread" ) ;
388
+ }
389
+
386
390
let event = flutter_engine_sys:: FlutterWindowMetricsEvent {
387
391
struct_size : std:: mem:: size_of :: < flutter_engine_sys:: FlutterWindowMetricsEvent > ( ) ,
388
392
width,
@@ -407,6 +411,10 @@ impl FlutterEngine {
407
411
device_kind : FlutterPointerDeviceKind ,
408
412
buttons : FlutterPointerMouseButtons ,
409
413
) {
414
+ if !self . is_platform_thread ( ) {
415
+ panic ! ( "Not on platform thread" ) ;
416
+ }
417
+
410
418
let timestamp =SystemTime :: now ( ) . duration_since ( UNIX_EPOCH ) . unwrap ( ) ;
411
419
let buttons: flutter_engine_sys:: FlutterPointerMouseButtons = buttons. into ( ) ;
412
420
let event = flutter_engine_sys:: FlutterPointerEvent {
@@ -436,6 +444,7 @@ impl FlutterEngine {
436
444
if !self . is_platform_thread ( ) {
437
445
panic ! ( "Not on platform thread" ) ;
438
446
}
447
+
439
448
unsafe {
440
449
flutter_engine_sys:: FlutterEngineSendPlatformMessage (
441
450
self . engine_ptr ( ) ,
@@ -453,6 +462,7 @@ impl FlutterEngine {
453
462
if !self . is_platform_thread ( ) {
454
463
panic ! ( "Not on platform thread" ) ;
455
464
}
465
+
456
466
unsafe {
457
467
flutter_engine_sys:: FlutterEngineSendPlatformMessageResponse (
458
468
self . engine_ptr ( ) ,