Skip to content

[iOS] add controller.print(String) to FlutterViewController #39240

@lukepighetti

Description

@lukepighetti

Allow us to print to Flutter's console with a FlutterViewController.print method. I am requesting this because I am not aware of any way to print to the Flutter console from within Swift on iOS.

eg

let printChannel = FlutterMethodChannel(name: "console", binaryMessenger: controller.binaryMessenger);
printChannel.invokeMethod("print", arguments: "1printyboiiiiiiiI!!!")
void main() {
  MethodChannel("console").setMethodCallHandler((call) {
    if (call.method == "print") {
      print(call.arguments);
    }

    return;
  });

  runApp(_MyApp());
}
flutter: 1printyboiiiiiiiI!!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: proposalA detailed proposal for a change to Flutterengineflutter/engine related. See also e: labels.platform-iosiOS applications specificallyteam-iosOwned by iOS platform teamtriaged-iosTriaged by iOS platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions