import 'package:flutter/services.dart'; class MotionService { static const MethodChannel _channel = MethodChannel('com.yourcompany.app/motion'); static Future startMotionUpdates() async { try { await _channel.invokeMethod('startMotionUpdates'); } on PlatformException catch (e) { print("Failed to start motion updates: '${e.message}'."); } } static Future stopMotionUpdates() async { try { await _channel.invokeMethod('stopMotionUpdates'); } on PlatformException catch (e) { print("Failed to stop motion updates: '${e.message}'."); } } }