@@ -118,23 +118,44 @@ extension _BfInteraction on FlutterMcpServer {
118118 return success ? "Swiped ${args ['direction' ]}" : "Swipe failed" ;
119119 case 'drag' :
120120 if (client is BridgeDriver ) {
121+ // Support both key-based and coordinate-based drag
122+ if (args['start_x' ] != null ) {
123+ final result = await client.callMethod ('drag' , {
124+ 'start_x' : (args['start_x' ] as num ).toDouble (),
125+ 'start_y' : (args['start_y' ] as num ).toDouble (),
126+ 'end_x' : (args['end_x' ] as num ).toDouble (),
127+ 'end_y' : (args['end_y' ] as num ).toDouble (),
128+ });
129+ return result;
130+ }
121131 final result = await client.callMethod (
122132 'drag' , {'from_key' : args['from_key' ], 'to_key' : args['to_key' ]});
123133 return result['success' ] == true ? "Dragged" : "Drag failed" ;
124134 }
125135 final fc = _asFlutterClient (client! , 'drag' );
126- final success =
127- await fc.drag (fromKey: args['from_key' ], toKey: args['to_key' ]);
136+ // Support coordinate-based drag via swipeCoordinates for FlutterClient
137+ if (args['start_x' ] != null ) {
138+ final result = await fc.swipeCoordinates (
139+ (args['start_x' ] as num ).toDouble (),
140+ (args['start_y' ] as num ).toDouble (),
141+ (args['end_x' ] as num ).toDouble (),
142+ (args['end_y' ] as num ).toDouble (),
143+ );
144+ return result;
145+ }
146+ final success = await fc.drag (
147+ fromKey: args['from_key' ] as String ? ?? '' ,
148+ toKey: args['to_key' ] as String ? ?? '' );
128149 return success ? "Dragged" : "Drag failed" ;
129150
130151 // State & Validation
131152 case 'get_text_value' :
132153 if (client is BridgeDriver ) {
133- final text = await client.getText (key: args['key' ]);
154+ final text = await client.getText (key: args['key' ] as String ? );
134155 return {"success" : true , "text" : text};
135156 }
136157 final fc = _asFlutterClient (client! , 'get_text_value' );
137- return await fc.getTextValue (args['key' ]);
158+ return await fc.getTextValue (args['key' ] as String ? );
138159 case 'get_checkbox_state' :
139160 if (client is BridgeDriver ) {
140161 return await client
0 commit comments