03:交互 flutter 和原生

#import "BDTOrderFlutterVC.h"

#import "Pigeons.h"

 

 

  FlutterEngine *flutterEngine1 =

            ((BDTAppDelegate *)UIApplication.sharedApplication.delegate).flutterEngine;

    BDTOrderFlutterVC *flutterViewController1 =

            [[BDTOrderFlutterVC alloc] initWithEngine:flutterEngine1 nibName:nil bundle:nil];

        [flutterViewController1 setRouteString:@"/orders/mine"];

        

    [self pushVC:flutterViewController1 hideTabbar:YES];

 

 

 

 

FlutterEngine *flutterEngine1 =

            ((BDTAppDelegate *)UIApplication.sharedApplication.delegate).flutterEngine;

    BDTOrderFlutterVC *flutterViewController1 =

            [[BDTOrderFlutterVC alloc] initWithEngine:flutterEngine1 nibName:nil bundle:nil];

        [flutterViewController1 setRouteString:@"/orders/vipOrderList"];

//        [flutterViewController1 setRouteString:@"/vipOrderList"];

 

    

    

    [self pushVC:flutterViewController1 hideTabbar:YES];

 

 

 

    FlutterEngine *flutterEngine1 =

            ((BDTAppDelegate *)UIApplication.sharedApplication.delegate).flutterEngine;

    BDTOrderFlutterVC *flutterViewController1 =

            [[BDTOrderFlutterVC alloc] initWithEngine:flutterEngine1 nibName:nil bundle:nil];

        [flutterViewController1 setRouteString:@"/orders/vipOrderList"];

//        [flutterViewController1 setRouteString:@"/vipOrderList"];

 

    

    

    [self pushVC:flutterViewController1 hideTabbar:YES];

 

    return;

    FlutterEngine *flutterEngine =

            ((BDTAppDelegate *)UIApplication.sharedApplication.delegate).flutterEngine;

//    [flutterEngine runWithEntrypoint:nil initialRoute:@"/orders/vipOrderList"];

    

    BDTOrderFlutterVC *flutterViewController =

            [[BDTOrderFlutterVC alloc] initWithEngine:flutterEngine nibName:nil bundle:nil ];

//    flutterViewController.routeString = @"/orders/vipOrderList";

//    [flutterViewController pushRoute:@"/orders/vipOrderList"];

//    BDTOrderFlutterVC *flutterViewController = [[BDTOrderFlutterVC alloc] initWithProject:nil initialRoute:@"/orders/vipOrderList" nibName:nil bundle:nil];

    [self pushVC:flutterViewController hideTabbar:YES];

    

    return;

    FlutterMethodChannel* OCToFlutterChannel = [FlutterMethodChannel methodChannelWithName:@"BDTTranslate.flutter.io/channel" binaryMessenger:flutterViewController.binaryMessenger];

    

    FlutterMethodChannel* flutterToOCChannel = [FlutterMethodChannel methodChannelWithName:@"flutter.BDTTranslate.io/channel" binaryMessenger:flutterViewController.binaryMessenger];

    //延时调用

    /******************   OC调用flutter   **********************************/

    //

    [OCToFlutterChannel invokeMethod:@"getFlutterOrderFunc" arguments:@{@"student":@"张三",

                                                                  @"name":@"李四"

                                                                  }

      result:^(id  _Nullable result) {

          //flutter回调信息

          NSLog(@"%@",result);

    }];

    /******************    OC调用flutter  **********************************/

 

    

    /******************    flutter调用OC   **********************************/

    [flutterToOCChannel setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) {

        NSLog(@"%@-%@",call.method, call.arguments);

        if ([@"getOcOrderFunc" isEqualToString:call.method]) {

            NSLog(@"getOcOrderFunc-%@", call.arguments);

            result(call.arguments);

        }

        else {

            result(FlutterMethodNotImplemented);

        }

    }];

    

    /******************    flutter调用OC   **********************************/

 

posted on 2023-05-31 14:15  风zk  阅读(43)  评论(0编辑  收藏  举报

导航