Skip to content

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

Closed
flutter/packages
#3455

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.

Activity

  1. added
    in triagePresently being triaged by the triage team
    on Mar 8, 2023
  2. huycozy commented on Mar 8, 2023

    @huycozy
    Member

    Thanks for the report! This is a known issue being tracked at #120861. Closing this issue as a duplicate, so please follow up on it for further updates.

  3. added
    r: duplicateIssue is closed as a duplicate of an existing issue
    and removed
    in triagePresently being triaged by the triage team
    on Mar 8, 2023
  4. stuartmorgan-g commented on Mar 8, 2023

    @stuartmorgan-g
    Contributor

    This is unrelated to exceptions

  5. added
    packageflutter/packages repository. See also p: labels.
    p: pigeonrelated to pigeon messaging codegen tool
    P2Important issues not at the top of the work list
    and removed
    r: duplicateIssue is closed as a duplicate of an existing issue
    on Mar 8, 2023
  6. stuartmorgan-g commented on Mar 8, 2023

    @stuartmorgan-g
    Contributor

    We fixed this for Kotlin, but not Swift.

    @tarrinneal per discussion we should also add an e2e test that echos an int outside the 32-bit range.

  7. github-actions commented on Mar 28, 2023

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  8. locked as resolved and limited conversation to collaborators on Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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