Skip to content

pigeon: missing required import in autogenerated .dart #64806

Description

@arsenioo

@gaaclarke

Steps to Reproduce

  1. Create a pigeon interface with result or parameter class with Uint8List supported type field
  2. Generate dart/platform files

Expected results:

Successful compilation, no need to edit auto generated .dart file

Actual results:

Auto generated dart compilation error due to missing import 'dart:typed_data'

Activity

  1. gaaclarke commented on Aug 28, 2020

    @gaaclarke
    Member

    Please provide the results to flutter doctor -v

  2. arsenioo commented on Aug 28, 2020

    @arsenioo
    Author

    Please provide the results to flutter doctor -v

    OK, thank you for prompt response! But generally speaking, this is a very evident issue regardless of actual configuration. That's why I've omitted extra unrelated details.

    [✓] Flutter (Channel master, 1.22.0-2.0.pre.106, on Mac OS X 10.15.6 19G2021,
        locale en-UA)
        • Flutter version 1.22.0-2.0.pre.106 at /Users/apc/Library/flutter
        • Framework revision 2ae25cc2d7 (2 hours ago), 2020-08-28 09:00:53 -0700
        • Engine revision 77dd1c05b9
        • Dart version 2.10.0 (build 2.10.0-67.0.dev)
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
        • Android SDK at /Users/apc/Library/Android/sdk
        • Platform android-29, build-tools 29.0.2
        • ANDROID_HOME = /Users/apc/Library/Android/sdk
        • ANDROID_SDK_ROOT = /Users/apc/Library/Android/sdk
        • Java binary at: /Applications/Android
          Studio.app/Contents/jre/jdk/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build
          1.8.0_242-release-1644-b3-6222593)
        • All Android licenses accepted.
    
    [✗] Xcode - develop for iOS and macOS
        ✗ Xcode installation is incomplete; a full installation is necessary for iOS
          development.
          Download at: https://developer.apple.com/xcode/download/
          Or install Xcode via the App Store.
          Once installed, run:
            sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
            sudo xcodebuild -runFirstLaunch
        ✗ CocoaPods not installed.
            CocoaPods is used to retrieve the iOS and macOS platform side's plugin
            code that responds to your plugin usage on the Dart side.
            Without CocoaPods, plugins will not work on iOS or macOS.
            For more info, see https://flutter.dev/platform-plugins
          To install:
            sudo gem install cocoapods
    
    [✓] Android Studio (version 4.0)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin version 48.1.2
        • Dart plugin version 193.7547
        • Java version OpenJDK Runtime Environment (build
          1.8.0_242-release-1644-b3-6222593)
    
    [✓] Connected device (2 available)
        • Nexus 10 (mobile)       • R32D100K5GE   • android-arm • Android 5.1.1 (API
          22)
        • sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API
          30) (emulator)
    
    
  3. gaaclarke commented on Aug 28, 2020

    @gaaclarke
    Member

    Thanks, I'll have to look into this. It isn't immediately clear to me what is happening in your setup. We have a number of integration tests that don't experience this problem. There must be something different about your setup. Ideally I find out the root cause before addressing it.

  4. arsenioo commented on Aug 28, 2020

    @arsenioo
    Author

    The thing is that as soon as I add import 'dart:typed_data' into generated file, everything works immediately like a charm.
    Even in a pigeon file this import is required before generation, otherwise Uint8List is underlined with error:

    
    import 'dart:typed_data';
    import 'package:pigeon/pigeon_lib.dart';
    
    class ProductInfo {
      Uint8List pngIcon;
      double pngIconSize;
      String applicationName;
      String applicationVersion;
    }
    
    
  5. AlexBokhankovich commented on Aug 29, 2020

    @AlexBokhankovich

    I've faced this issue too. I also use Uint8List in my request class field

  6. gaaclarke commented on Sep 9, 2020

    @gaaclarke
    Member

    fixed in 0.1.5

  7. github-actions commented on Aug 12, 2021

    @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 Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    p: 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