Skip to content

[pigeon] Support pass int64 from Swift to Dart #122160

@bc-lee

Description

@bc-lee

According to https://github.com/flutter/packages/blob/4aa259aa4f21e2cf510e5fc7755fbd26175807f2/packages/pigeon/lib/swift_generator.dart#L711, Users don't seem to be able to pass int64 without converting to another type like int32 or double.

Example dart code:

import 'package:pigeon/pigeon.dart';

@FlutterApi()
abstract class Callback {
  void onEvent(int timestampNs);
}

generates following swift code:

/// Generated class from Pigeon that represents Flutter messages that can be called from Swift.
class Callback {
  private let binaryMessenger: FlutterBinaryMessenger
  init(binaryMessenger: FlutterBinaryMessenger){
    self.binaryMessenger = binaryMessenger
  }
  func onEvent(timestampNs timestampNsArg: Int32, completion: @escaping () -> Void) {
    let channel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.Callback.onEvent", binaryMessenger: binaryMessenger)
    channel.sendMessage([timestampNsArg] as [Any?]) { _ in
      completion()
    }
  }
}

It would be nice to be able to pass int64 from Swift to Dart using pigeon.

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listp: pigeonrelated to pigeon messaging codegen toolpackageflutter/packages repository. See also p: labels.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions