Skip to content

plugin_ffi generated example code triggers library_private_types_in_public_api lint #115347

@domesticmouse

Description

@domesticmouse

Steps to reproduce:

  1. Generated template code:
$ flutter create --template=plugin_ffi --platforms=linux,macos,windows,android,ios msfa_plugin
Signing iOS app for device deployment using developer identity: "Apple Development: Brett Morgan (XXXXXX)"
Creating project msfa_plugin...
Running "flutter pub get" in msfa_plugin...                      1,913ms
Running "flutter pub get" in example...                          1,949ms
Wrote 145 files.

All done!

Your plugin code is in msfa_plugin/lib/msfa_plugin.dart.

Your example app code is in msfa_plugin/example/lib/main.dart.


Host platform code is in the linux, macos, windows, android, ios directories under msfa_plugin.
To edit platform code in an IDE see https://flutter.dev/developing-packages/#edit-plugin-package.


To add platforms, run `flutter create -t plugin_ffi --platforms <platforms> .` under msfa_plugin.
For more information, see https://flutter.dev/go/plugin-platforms.
  1. Install dependencies:
$ cd msfa_plugin
$ flutter pub get
Running "flutter pub get" in msfa_plugin...                        222ms
Running "flutter pub get" in example...                            214ms
  1. Analyze the project
$ dart analyze
Analyzing msfa_plugin...               1.6s

   info • example/lib/main.dart:14:3 • Avoid using private types in public APIs. • library_private_types_in_public_api

1 issue found.

The issue is that the generated code in example/lib/main.dart contains the following code:

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  _MyAppState createState() => _MyAppState();
}

The easiest fix for this would be to generate the following instead:

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

Flutter Doctor output:

flutter doctor -v
[✓] Flutter (Channel stable, 3.3.8, on macOS 13.1 22C5044e darwin-arm, locale en)
    • Flutter version 3.3.8 on channel stable at /Users/brettmorgan/flutter
    • Upstream repository https://github.com/flutter/flutter
    • Framework revision 52b3dc25f6 (6 days ago), 2022-11-09 12:09:26 +0800
    • Engine revision 857bd6b74c
    • Dart version 2.18.4
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/brettmorgan/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14B47b
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] IntelliJ IDEA Community Edition (version 2022.2.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 70.0.5
    • Dart plugin version 222.4167.21

[✓] VS Code (version 1.73.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.52.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 13.1 22C5044e darwin-arm
    • Chrome (web)    • chrome • web-javascript • Google Chrome 107.0.5304.110

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Metadata

Metadata

Assignees

Labels

found in release: 3.3Found to occur in 3.3found in release: 3.6Found to occur in 3.6has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versiontoolAffects the "flutter" command-line tool. See also t: labels.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions