wuba / fair Goto Github PK
View Code? Open in Web Editor NEWA Flutter package used to update widget tree dynamically. Fair提供一整套Flutter动态化解决方案
Home Page: https://fair.58.com
License: BSD 3-Clause "New" or "Revised" License
A Flutter package used to update widget tree dynamically. Fair提供一整套Flutter动态化解决方案
Home Page: https://fair.58.com
License: BSD 3-Clause "New" or "Revised" License
问题
在ios使用plugin调用dart侧方法报错,在Android可以正常调用
环境信息
提供Fair版本号
dependencies:
fair: 2.7.0
相关截图【可选】
[Fair]:
File:FairDartBridge.m,
Function:-[FairDartBridge setDartListener]_block_invoke,
Line:87 >>
{"pageName":"plugin_test#0","type":"method","args":{"funcName":"_onPressed","args":null}}
[Fair]:
File:FairJSBridge.m,
Function:-[FairJSBridge context]_block_invoke,
Line:220 >>
exceptionValue:ReferenceError: Cannot access uninitialized variable.
[Fair]:
File:FairDartBridge.m,
Function:-[FairDartBridge setDartListener]_block_invoke_2,
Line:92 >>
undefined
[Fair]:
File:FairDartBridge.m,
Function:-[FairDartBridge setDartListener]_block_invoke_2,
Line:96 >>
undefined
问题
在本地一个 demo 工程中引入了 Fair,然后使用 flutter build apk
构建出 Release 包,安装 APK,启动 APP 直接闪退。
环境信息
执行下面的语句,并粘贴结果
[✓] Flutter (Channel stable, 3.0.5, on macOS 12.2.1 21D62 darwin-arm, locale
zh-Hans-CN)
• Flutter version 3.0.5 at /Users/chenyouyu/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f1875d570e (4 weeks ago), 2022-07-13 11:24:16 -0700
• Engine revision e85ea0e79c
• Dart version 2.17.6
• DevTools version 2.12.2
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/chenyouyu/Library/Android/sdk
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for
more details.
[✗] 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 see
https://guides.cocoapods.org/using/getting-started.html#installation for
instructions.
[✓] 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)
[✓] VS Code (version 1.69.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (3 available)
• JEF AN00 (mobile) • E6EDU20429059373 • android-arm64 • Android 10 (API
29)
• macOS (desktop) • macos • darwin-arm64 • macOS 12.2.1 21D62
darwin-arm
• Chrome (web) • chrome • web-javascript • Google Chrome
104.0.5112.79
[✓] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 2 categories.
提供Fair版本号
dependencies:
fair: 2.7.0
复现操作【可选】
1.使用 flutter build apk
构建出 Release 包;
2.安装并启动 APP,直接闪退。
autoImport 可执行文件是什么内容?
MissingPluginException(No implementation found for method loadMainJs on channel com.wuba.fair/js_loader)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)
debug运行偶现,release运行必现
问题
执行 flutter pub run build_runner build
转换时,报错。
Bad state: Unexpected diagnostics:
/Users/yyinc/fvm/versions/2.5.0/bin/cache/dart-sdk/lib/core/int.dart:117:18 - Operator declarations must be preceded by the keyword 'operator'.
/Users/yyinc/fvm/versions/2.5.0/bin/cache/dart-sdk/lib/core/int.dart:117:16 - Methods must have an explicit list of parameters.
/Users/yyinc/fvm/versions/2.5.0/bin/cache/dart-sdk/lib/core/int.dart:117:18 - A function body must be provided.
环境信息
[✓] Flutter (Channel unknown, 2.5.0, on macOS 11.5.2 20G95 darwin-x64, locale zh-Hans-CN)
• Flutter version 2.5.0 at /Users/yyinc/fvm/versions/2.5.0
• Upstream repository unknown
• Framework revision 4cc385b4b8 (3 months ago), 2021-09-07 23:01:49 -0700
• Engine revision f0826da7ef
• Dart version 2.14.0
• Flutter download mirror https://storage.flutter-io.cn
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/yyinc/Library/Android/sdk
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 13.0, Build version 13A233
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.1)
• 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 1.8.0_242-release-1644-b3-6915495)
[✓] IntelliJ IDEA Ultimate Edition (version 2020.3.3)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin version 203.7759
[✓] VS Code (version 1.62.3)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.28.0
[✓] Connected device (3 available)
• V1824BA (mobile) • 9ce2cf42 • android-arm64 • Android 11 (API 30)
• iPhone (mobile) • 00008030-001269112EE3402E • ios • iOS 14.8.1 18H107
• Chrome (web) • chrome • web-javascript • Google Chrome 96.0.4664.55
! Doctor found issues in 1 category.
复现步骤
在 master 分支下的 fair example
运行命令。
commit: e76062a61da0de870862b2897b032e1fb6fafd87
。
assets目录下的*.faric.tar.gz是未开源的,这个是你们框架代码吗?还是有别的原因导致这一部分不能够放开?
readme中说支持Flutter SDK 2.10.0, 2.10.1, 2.10.2, 2.10.3;
但是我看merge已经合并了相关3.0的支持?
[INFO] 1m 13s elapsed, 3/4 actions completed.
[INFO] 1m 14s elapsed, 3/4 actions completed.
[INFO] 1m 15s elapsed, 3/4 actions completed.
[INFO] 1m 16s elapsed, 3/4 actions completed.
[INFO] 1m 18s elapsed, 3/4 actions completed.
[INFO] 1m 19s elapsed, 3/4 actions completed.
[INFO] 1m 20s elapsed, 3/4 actions completed.
[INFO] 1m 21s elapsed, 3/4 actions completed.
[INFO] 1m 22s elapsed, 3/4 actions completed.
[INFO] 1m 23s elapsed, 3/4 actions completed.
[INFO] 1m 24s elapsed, 3/4 actions completed.
[INFO] 1m 25s elapsed, 3/4 actions completed.
[INFO] 1m 26s elapsed, 3/4 actions completed.
[SEVERE] fair_compiler:fairc on lib/home_page.dart:
SocketException: OS Error: Operation timed out, errno = 60, address = github.com, port = 55048
[INFO] Running build completed, took 1m 27s
[INFO] Caching finalized dependency graph...
[INFO] Caching finalized dependency graph completed, took 27ms
为什么会这样。。
flutter版本 2.5.0
使用 flutter pub run build_runner build 转换报错
Failed to build build_runner:build_runner:
../../../../../../.pub-cache/hosted/pub.flutter-io.cn/analyzer-0.41.2/lib/src/error/best_practices_verifier.dart:258:50: Error: The property 'displayString' is defined in multiple extensions for 'TargetKind' and neither is more specific.
什么时候适配flutter 2.0?
问题
富文本 图片 + 文字 ,中, 图片会加载不了
//图标 + 标题
Expanded(
child: Padding(
padding: EdgeInsets.only(right: 10),
child: RichText(
text: TextSpan(
children: [
//icon
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: Image.asset(
'assets/image/icon_new_jd.png',
width: 13,
height: 13,
fit: BoxFit.fitWidth,
)
),
//标题
TextSpan(
text: mgoodInfo.itemTitle,
style: TextStyle(fontSize: 13, color: Colors.black87),
),
]
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
softWrap: true,
),
),
),
环境信息
flutter sdk 1.17.3
提供Fair版本号
# # 添加 Fair 依赖
fair: ^0.2.0
dev_dependencies:
flutter_test:
sdk: flutter
# 添加编译器依赖
build_runner: ^1.4.0
fair_compiler: ^0.2.0
# Switch to another stable flutter version
dependency_overrides:
fair_version:
git:
url: https://github.com/wuba/fair.git
ref: main
path: fair_version/flutter_1_17_3
D:\project\flutter_fair>flutter pub run build_runner build
[INFO] Generating build script...
[INFO] Generating build script completed, took 287ms
[INFO] Creating build script snapshot......
[INFO] Creating build script snapshot... completed, took 10.3s
[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 734ms
[INFO] Checking for unexpected pre-existing outputs....
[INFO] Checking for unexpected pre-existing outputs. completed, took 1ms
[INFO] Running build...
[INFO] Generating SDK summary...
[INFO] 2.8s elapsed, 0/1 actions completed.
[INFO] Generating SDK summary completed, took 2.7s
[INFO] 3.8s elapsed, 0/1 actions completed.
[INFO] 6.2s elapsed, 0/1 actions completed.
[WARNING] fair_compiler:fairc on lib/main.dart:
[Fair] Compile lib/main.dart into bundle...
[INFO] 14.3s elapsed, 0/1 actions completed.
[SEVERE] fair_compiler:fairc on lib/main.dart:
FileSystemException: Cannot create file, path = 'build\fair\log\2021-02-01 15:40:016.txt' (OS Error: 文件名、目录名或卷标语法不正确。
, errno = 123)
[INFO] Running build completed, took 14.7s
[INFO] Caching finalized dependency graph...
[INFO] Caching finalized dependency graph completed, took 34ms
[SEVERE] Failed after 14.7s
pub finished with exit code 1
Thanks for creating the flutter package.
As fair is relative new compare to dynamic_widget at https://pub.dev/packages/dynamic_widget, may I know why you guys created fair instead of reuse the implementation of dynamic_widget?
flutter doctor --verbose
问题
fair: ^2.0.0 使用这个引入fair
提示 depends on fair ^2.0.0 which doesn't match any versions, version solving failed.
环境信息
执行下面的语句,并粘贴结果
flutter doctor --verbose
提供Fair版本号
dependencies:
fair: x.y.z
复现操作【可选】
Steps to reproduce the behavior:
预期【可选】
A clear and concise description of what you expected to happen.
相关截图【可选】
If applicable, add screenshots to help explain your problem.
其他【可选】
Add any other context about the problem here.
通过FairWidget data传递json数据,例如
{
"arguments":{
"name":"测试"
}
}
在fairwidget中获取传递过来的参数
@FairProps()
var data;
// JS生命周期方法--在JS加载完成自动调用
void onLoad() {
//这种写法无法获取到name字段
var name = data['arguments']['name'];
//这种写法才能获取到字段
var name = data['arguments'].name;
}
执行 flutter pub run build_runner build
编译失败时无法输出日志,因为 windows 下的文件名不允许包含冒号。
FileSystemException: Cannot create file, path = 'build\fair\log\2021-03-20_10:58:048.txt' (OS Error: 文件名、目录名或卷标语法不正确。, errno = 123)
问题
之前 ‘ flutter pub run build_runner build ’可以转的,现在转不了,一样的代码
环境信息
Flutter sdk 1.17.3
提供Fair版本号
fair: ^0.2.0
dev_dependencies:
flutter_test:
sdk: flutter
build_runner: ^1.4.0
fair_compiler: ^0.2.0
dependency_overrides:
fair_version:
git:
url: https://github.com/wuba/fair.git
ref: main
path: fair_version/flutter_1_17_3
解决的办法】
flutter packages pub run build_runner clean
flutter packages pub run build_runner build --delete-conflicting-outputs
问题
InlineExpression can't recongize '${delegate.title}'
环境信息
dependencies:
fair: 0.3.0
�Variable cannot be replaced normally
问题
引用了第三方框架:
#框架1
common_utils: ^1.2.1
cached_network_image: ^2.2.0+1
extended_text: ^0.6.6
在mian如此声明:
@FairBinding(
packages: [
'package:cached_network_image/cached_network_image.dart',
'package:common_utils/common_utils.dart',
'package:extended_text/extended_text.dart'
])
但是转不出来
【备注:自定义的框架可以转出来】
环境信息
flutter sdk 1.17.3
提供Fair版本号
fair: ^0.2.0
dev_dependencies:
flutter_test:
sdk: flutter
build_runner: ^1.4.0
fair_compiler: ^0.2.0
dependency_overrides:
fair_version:
git:
url: https://github.com/wuba/fair.git
ref: main
path: fair_version/flutter_1_17_3
问题
执行flutter pub run build_runner build无法获得产物
环境信息
likairandeMacBook-Pro:fair_list_demo zyb$ flutter --version
Flutter 2.0.6 • channel unknown • unknown source
Framework • revision 1d9032c7e1 (4 months ago) • 2021-04-29 17:37:58 -0700
Engine • revision 05e680e202
Tools • Dart 2.12.3
likairandeMacBook-Pro:fair_list_demo zyb$ flutter doctor --verbose
[✓] Flutter (Channel unknown, 2.0.6, on macOS 11.0.1 20B50 darwin-x64, locale zh-Hans-CN)
• Flutter version 2.0.6 at /Users/zyb/flutter
• Framework revision 1d9032c7e1 (4 months ago), 2021-04-29 17:37:58 -0700
• Engine revision 05e680e202
• Dart version 2.12.3
• Pub download mirror https://pub.flutter-io.cn
• Flutter download mirror https://storage.flutter-io.cn
Fair版本号
dependencies:
fair: x.y.z
fair main分支,
commit 241fa80c0ca84a9da1376a6004f02b99f0ad6c50
操作过程
likairandeMacBook-Pro:fair_list_demo zyb$ flutter pub run build_runner build
[INFO] Generating build script...
[INFO] Generating build script completed, took 385ms
[INFO] Creating build script snapshot......
[INFO] Creating build script snapshot... completed, took 11.0s
[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 625ms
[INFO] Checking for unexpected pre-existing outputs....
[INFO] Checking for unexpected pre-existing outputs. completed, took 1ms
[INFO] Running build...
[WARNING] fair_compiler:fairc on lib/main.dart:
Your current `analyzer` version may not fully support your current SDK version.
Please try upgrading to the latest `analyzer` by running `flutter packages upgrade`.
Analyzer language version: 2.10.0
SDK language version: 2.12.0
If you are getting this message and have the latest analyzer please file
an issue at https://github.com/dart-lang/sdk/issues/new with the title
"No published analyzer available for language version 2.12.0".
Please search the issue tracker first and thumbs up and/or subscribe to
existing issues if present to avoid duplicates.
[INFO] Generating SDK summary...
[SEVERE] fair_compiler:fairc on lib/main.dart:
Bad state: Unexpected diagnostics:
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:166:25 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:539:15 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:390:19 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:30:49 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:18:62 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:42:22 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:327:34 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:376:19 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:516:13 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:224:29 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:65:23 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:58:17 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:41:23 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:132:29 - This requires the 'non-nullable' language feature to be enabled.
[SEVERE] fair_compiler:fairc on lib/main.dart:
Bad state: Unexpected diagnostics:
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:166:25 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:539:15 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:390:19 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:30:49 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:18:62 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:42:22 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:327:34 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:376:19 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:516:13 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:224:29 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:65:23 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:58:17 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:41:23 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:132:29 - This requires the 'non-nullable' language feature to be enabled.
[SEVERE] fair_compiler:fairc on lib/main.dart:
Bad state: Unexpected diagnostics:
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:166:25 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:539:15 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:390:19 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:30:49 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:18:62 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:42:22 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:327:34 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:376:19 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:516:13 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:224:29 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:65:23 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:58:17 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:41:23 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:132:29 - This requires the 'non-nullable' language feature to be enabled.
[SEVERE] fair_compiler:fairc on lib/main.dart:
Bad state: Unexpected diagnostics:
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:166:25 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:539:15 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:390:19 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:30:49 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:18:62 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:42:22 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:327:34 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:376:19 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:516:13 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:224:29 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:65:23 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:58:17 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:41:23 - This requires the 'non-nullable' language feature to be enabled.
/Users/zyb/flutter/bin/cache/pkg/sky_engine/lib/ui/channel_buffers.dart:132:29 - This requires the 'non-nullable' language feature to be enabled.
[INFO] 2.6s elapsed, 1/4 actions completed.
[INFO] 3.7s elapsed, 1/4 actions completed.
[INFO] 4.7s elapsed, 1/4 actions completed.
[INFO] 5.7s elapsed, 1/4 actions completed.
[INFO] 6.8s elapsed, 1/4 actions completed.
[INFO] 7.9s elapsed, 1/4 actions completed.
[INFO] 8.9s elapsed, 1/4 actions completed.
[INFO] 10.0s elapsed, 1/4 actions completed.
[INFO] 11.1s elapsed, 1/4 actions completed.
[INFO] 12.2s elapsed, 1/4 actions completed.
[INFO] 13.3s elapsed, 1/4 actions completed.
[INFO] 14.4s elapsed, 1/4 actions completed.
[INFO] 15.5s elapsed, 1/4 actions completed.
[WARNING] No actions completed for 15.0s, waiting on:
- fair_compiler:fairc on lib/JRList.dart
- fair_compiler:fairc on lib/my_list.dart
- fair_compiler:fairc on lib/list_proxy.dart
之后会一直循环输出
[INFO] 17.6s elapsed, 1/4 actions completed.
[INFO] 18.7s elapsed, 1/4 actions completed.
[INFO] 19.8s elapsed, 1/4 actions completed.
[INFO] 20.9s elapsed, 1/4 actions completed.
[INFO] 22.0s elapsed, 1/4 actions completed.
[INFO] 23.1s elapsed, 1/4 actions completed.
[INFO] 24.1s elapsed, 1/4 actions completed.
[INFO] 25.2s elapsed, 1/4 actions completed.
[INFO] 26.3s elapsed, 1/4 actions completed.
[INFO] 27.4s elapsed, 1/4 actions completed.
[INFO] 28.5s elapsed, 1/4 actions completed.
[INFO] 29.6s elapsed, 1/4 actions completed.
[INFO] 30.7s elapsed, 1/4 actions completed.
[WARNING] No actions completed for 15.1s, waiting on:
- fair_compiler:fairc on lib/JRList.dart
- fair_compiler:fairc on lib/my_list.dart
- fair_compiler:fairc on lib/list_proxy.dart
请问是设置的问题吗,.dart_tool文件夹删除过并没有解决问题
如何才能输出json文件
@FairBinding(packages: [
'package:cached_network_image/src/cached_image_widget.dart',
])出现报错
[SEVERE] fair_compiler:package on lib/$lib$ (cached):
Exception: [Fair] Failed to generate widget binding from =>
.dart_tool/build/fairc/source
No content is generated: build/fair/log/2022-08-12_16:07:035.txt
[SEVERE] Failed after 37.3s
pub finished with exit code 1
@FairBinding(packages: [
'package:pull_to_refresh/scr/smart_refresher.dart',
])出现报错 AssetNotFoundException: pull_to_refresh|lib/scr/smart_refresher.dart
目前试了这两个常见的库 都出现了问题...
如题。。
大神,根据demo写例子的时候,只生成了fair.json,fair.metadata 文件,
.fair.bin文件没有生成。
====================================
[INFO] Generating build script...
[INFO] Generating build script completed, took 269ms
[INFO] Creating build script snapshot......
[INFO] Creating build script snapshot... completed, took 8.7s
[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 602ms
[INFO] Checking for unexpected pre-existing outputs....
[INFO] Checking for unexpected pre-existing outputs. completed, took 1ms
[INFO] Running build...
[INFO] Generating SDK summary...
[INFO] 2.6s elapsed, 0/2 actions completed.
[INFO] Generating SDK summary completed, took 2.6s
[INFO] 3.6s elapsed, 0/2 actions completed.
[INFO] 4.6s elapsed, 0/2 actions completed.
[INFO] 6.3s elapsed, 0/2 actions completed.
[INFO] 10.6s elapsed, 1/2 actions completed.
[WARNING] fair_compiler:fairc on lib/dynamicWidget.dart:
[Fair] Compile lib/dynamicWidget.dart into bundle...
[INFO] 13.3s elapsed, 1/2 actions completed.
[WARNING] Instance of 'ArchiveBuilder' on flutter_app_fair|lib/dynamicWidget.bundle.json:
[Fair] New bundle generated => build\fair\lib_dynamicWidget.fair.json
[INFO] Running build completed, took 13.7s
[INFO] Caching finalized dependency graph...
[INFO] Caching finalized dependency graph completed, took 44ms
[INFO] Succeeded after 13.7s with 1 outputs (6 actions)
问题
目前delegate名称必须与fairwidget名称对应,不能支持多个delegate。
fairplugin不支持dart到js的自动转化,每次需要手写js。
预期
可以支持一个fairwidget支持多个delegate。
fairplugin支持dart到js的自动转化。
@zhiqingchen
什么时候支持空安全?
code:
import 'package:flutter/material.dart';
import 'package:fair_annotation/fair_annotation.dart';
@FairPatch()
class DynamicWidget extends StatelessWidget {
@Fairwell('content')
final String content;
const DynamicWidget({Key key, this.content}) : super(key: key);
@OverRide
Widget build(BuildContext context) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
content,
style: TextStyle(fontSize: 30, color: Colors.yellow),
),
TextField(),
SizedBox(height: 20),
TextField(
maxLines: null,
onChanged: (String txt) {},
style: TextStyle(
fontFamily: 'WorkSans',
fontSize: 16,
color: Color(0xFF313A44),
),
cursorColor: Colors.blue,
decoration: InputDecoration(
border: InputBorder.none,
hintText: 'Enter your feedback...'),
),
]
)
);
}
}
问题
打开demo中的page_two出现异常错误:exceptionValue:TypeError: undefined is not an object
页面源码:
Navigator.pushNamed(context, 'fair_page_two', arguments: {
'path': 'assets/fair/lib_developer_page2page_page_two.fair.json',
'data': {'title': 'PageTwo'}
});
import 'package:fair/fair.dart';
import 'package:flutter/material.dart';
@FairPatch()
class PageTwo extends StatefulWidget {
PageTwo({Key? key, this.fairProps}) : super(key: key);
dynamic fairProps;
@OverRide
_PageTwoState createState() => _PageTwoState();
}
class _PageTwoState extends State {
@FairProps()
var fairProps;
@OverRide
void initState() {
super.initState();
fairProps = widget.fairProps;
}
String getTitle() {
return fairProps['title'];
}
@OverRide
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
/// 如果需要进行字符串拼接的话,在build()方法里进行拼接即可,不建议在getTitle()
/// 方法里做字符串拼接
title: Text('参数:${getTitle()}'),
),
body: Container(
child: Padding(
padding: EdgeInsets.all(20),
child: Text('xxxxx'),
)),
);
}
}
错误日志:
[Fair]:
File:FairDartBridge.m,
Function:-[FairDartBridge obtainModelWithMessage:],
Line:103 >>
{"path":"GLOBAL['null#1']=(function(initProps){const global=this;return runCallback(function(mod){with(mod.imports){function _PageTwoState(){const inner=_PageTwoState.inner;if(this==global){return new _PageTwoState({args:arguments});}else{const args=arguments.length>0?arguments[0].args||arguments:[];inner.apply(this,args);_PageTwoState.prototype.ctor.apply(this,args);return this;}}_PageTwoState.inner=function inner(){this.fairProps=initProps;};_PageTwoState.prototype={initState:function initState(){const thiz=this;with(thiz){fairProps=widget.fairProps;}},getTitle:function getTitle(){const thiz=this;with(thiz){return fairProps.op_idx('title');}},};_PageTwoState.prototype.ctor=function(){Object.prototype.ctor.call(this);};;return _PageTwoState();}},[]);})(convertObjectLiteralToSetOrMap(JSON.parse('{"title":"PageTwo"}')));","pageName":"null#1"}
[Fair]:
File:FairProcessManager.m,
Function:-[FairProcessManager injectionJSScriptWtihJSScript:callback:],
Line:59 >>
GLOBAL['null#1']=(function(initProps){const global=this;return runCallback(function(mod){with(mod.imports){function _PageTwoState(){const inner=_PageTwoState.inner;if(this==global){return new _PageTwoState({args:arguments});}else{const args=arguments.length>0?arguments[0].args||arguments:[];inner.apply(this,args);_PageTwoState.prototype.ctor.apply(this,args);return this;}}_PageTwoState.inner=function inner(){this.fairProps=initProps;};_PageTwoState.prototype={initState:function initState(){const thiz=this;with(thiz){fairProps=widget.fairProps;}},getTitle:function getTitle(){const thiz=this;with(thiz){return fairProps.op_idx('title');}},};_PageTwoState.prototype.ctor=function(){Object.prototype.ctor.call(this);};;return _PageTwoState();}},[]);})(convertObjectLiteralToSetOrMap(JSON.parse('{"title":"PageTwo"}')));
[Fair]:
File:FairJSBridge.m,
Function:-[FairJSBridge context]_block_invoke,
Line:220 >>
exceptionValue:ReferenceError: Can't find variable: GLOBAL
[Fair]:
环境信息
[✓] Flutter (Channel stable, 2.10.5, on macOS 12.3 21E230 darwin-arm, locale zh-Hans-CN)
• Flutter version 2.10.5 at /Users/xxx/fvm/versions/2.10.5
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 5464c5bac7 (4 months ago), 2022-04-18 09:55:37 -0700
• Engine revision 57d3bac3dd
• Dart version 2.16.2
• DevTools version 2.9.2
• Pub download mirror https://pub.flutter-io.cn
• Flutter download mirror https://storage.flutter-io.cn
提供Fair版本号
dependencies:
fair: ^2.6.1
C:\Users\asus>flutter --version
Flutter 1.22.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 7891006299 (3 months ago) • 2020-12-10 11:54:40 -0800
Engine • revision ae90085a84
Tools • Dart 2.10.4
error as flow:
[SEVERE] fair_compiler:fairc on lib/gunview/dynamicwidget.dart:
line 1, column 42 of package:flutterapp/gunview/dynamicwidget.dart: Could not resolve annotation for class DynamicWidget exten
ds StatelessWidget
╷
1 │ @FairBinding()
│ ^^^^^^^^^^^^^^
╵
[INFO] 14.9s elapsed, 2/3 actions completed.
Xcode's output:
↳
Writing result bundle at path:
/var/folders/s3/pwlp8skj5b5cps6j12nr14xm0000gn/T/flutter_tools.UHbYQW/flutter_ios_build_temp_dirztajXO/temporary_xcresult_bundle
../flutter_version/flutter_2_5_0/lib/src/widgets/$$c.dart:390:13: Error: No named parameter with the name 'capLeftEdge'.
capLeftEdge: props['capLeftEdge'] ?? true,
^^^^^^^^^^^
/opt/flutter/packages/flutter/lib/src/cupertino/picker.dart:354:9: Context: Found this candidate, but the arguments don't match.
const CupertinoPickerDefaultSelectionOverlay({
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../flutter_version/flutter_2_5_0/lib/src/widgets/$$c.dart:469:13: Error: No named parameter with the name 'maxLengthEnforced'.
maxLengthEnforced: props['maxLengthEnforced'] ?? true,
^^^^^^^^^^^^^^^^^
/opt/flutter/packages/flutter/lib/src/cupertino/text_field.dart:209:9: Context: Found this candidate, but the arguments don't match.
const CupertinoTextField({
^^^^^^^^^^^^^^^^^^
../flutter_version/flutter_2_5_0/lib/src/widgets/$$c.dart:530:13: Error: No named parameter with the name 'maxLengthEnforced'.
maxLengthEnforced: props['maxLengthEnforced'] ?? true,
^^^^^^^^^^^^^^^^^
/opt/flutter/packages/flutter/lib/src/cupertino/text_field.dart:373:9: Context: Found this candidate, but the arguments don't match.
const CupertinoTextField.borderless({
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../flutter_version/flutter_2_5_0/lib/src/widgets/$$w.dart:2184:44: Error: Undefined name 'Overflow'.
overflow: props['overflow'] ?? Overflow.clip,
^^^^^^^^
../flutter_version/flutter_2_5_0/lib/src/widgets/$$w.dart:2184:13: Error: No named parameter with the name 'overflow'.
overflow: props['overflow'] ?? Overflow.clip,
^^^^^^^^
/opt/flutter/packages/flutter/lib/src/widgets/basic.dart:3708:3: Context: Found this candidate, but the arguments don't match.
Stack({
^^^^^
../flutter_version/flutter_2_5_0/lib/src/widgets/$$w.dart:2780:13: Error: No named parameter with the name 'autovalidate'.
autovalidate: props['autovalidate'] ?? false,
^^^^^^^^^^^^
/opt/flutter/packages/flutter/lib/src/widgets/form.dart:40:9: Context: Found this candidate, but the arguments don't match.
const Form({
^^^^
../flutter_version/flutter_2_5_0/lib/src/widgets/$$w.dart:2797:13: Error: No named parameter with the name 'autovalidate'.
autovalidate: props['autovalidate'] ?? false,
^^^^^^^^^^^^
/opt/flutter/packages/flutter/lib/src/widgets/form.dart:262:9: Context: Found this candidate, but the arguments don't match.
const FormField({
^^^^^^^^^
../flutter_version/flutter_2_5_0/lib/src/widgets/$$w.dart:3100:47: Error: Method not found: 'DefaultTextEditingActions'.
'DefaultTextEditingActions': (props) => DefaultTextEditingActions(
^^^^^^^^^^^^^^^^^^^^^^^^^
../flutter_version/flutter_2_5_0/lib/src/widgets/$$m.dart:336:13: Error: No named parameter with the name 'maxLengthEnforced'.
maxLengthEnforced: props['maxLengthEnforced'] ?? true,
^^^^^^^^^^^^^^^^^
/opt/flutter/packages/flutter/lib/src/material/text_field.dart:276:9: Context: Found this candidate, but the arguments don't match.
const TextField({
^^^^^^^^^
../flutter_version/flutter_2_5_0/lib/src/widgets/$$m.dart:3797:31: Error: Member not found: 'class__sharp'.
'class__sharp': Icons.class__sharp,
^^^^^^^^^^^^
../flutter_version/flutter_2_5_0/lib/src/widgets/$$m.dart:3798:33: Error: Member not found: 'class__rounded'.
'class__rounded': Icons.class__rounded,
^^^^^^^^^^^^^^
../flutter_version/flutter_2_5_0/lib/src/widgets/$$m.dart:3799:34: Error: Member not found: 'class__outlined'.
'class__outlined': Icons.class__outlined,
^^^^^^^^^^^^^^^
../flutter_version/flutter_2_5_0/lib/src/widgets/$$m.dart:7351:37: Error: Member not found: 'pie_chart_outlined'.
'pie_chart_outlined': Icons.pie_chart_outlined,
^^^^^^^^^^^^^^^^^^
lib/best_flutter_ui/custom_drawer/drawer_user_controller.dart:70:20: Warning: Operand of null-aware operation '?.' has type 'WidgetsBinding' which excludes null.
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('/opt/flutter/packages/flutter/lib/src/widgets/binding.dart').
WidgetsBinding.instance?.addPostFrameCallback((_) => getInitState());
^
lib/best_flutter_ui/fitness_app/traning/training_screen.dart:29:28: Warning: Operand of null-aware operation '!' has type 'AnimationController' which excludes null.
- 'AnimationController' is from 'package:flutter/src/animation/animation_controller.dart' ('/opt/flutter/packages/flutter/lib/src/animation/animation_controller.dart').
parent: widget.animationController!,
^
lib/best_flutter_ui/fitness_app/traning/training_screen.dart:66:28: Warning: Operand of null-aware operation '!' has type 'AnimationController' which excludes null.
- 'AnimationController' is from 'package:flutter/src/animation/animation_controller.dart' ('/opt/flutter/packages/flutter/lib/src/animation/animation_controller.dart').
parent: widget.animationController!,
^
lib/best_flutter_ui/fitness_app/my_diary/meals_list_view.dart:47:27: Warning: Operand of null-aware operation '!' has type 'Animation<double>' which excludes null.
- 'Animation' is from 'package:flutter/src/animation/animation.dart' ('/opt/flutter/packages/flutter/lib/src/animation/animation.dart').
opacity: widget.mainScreenAnimation!,
^
Failed to package /Users/wuxiaoan/Desktop/flutter_dy_demo/fair/example.
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in dependency order
Result bundle written to path:
/var/folders/s3/pwlp8skj5b5cps6j12nr14xm0000gn/T/flutter_tools.UHbYQW/flutter_ios_build_temp_dirztajXO/temporary_xcresult_bundle
dependency_overrides:
fair_version:
path: ../flutter_version/flutter_2_5_0
dart2dsl中AstNodeMapBuilder没有指定generatedExtension,导致与json_serializable冲突出错。
报错:Both fair_dart2dsl:ast_node_map_builder and source_gen:combining_builder may output test/widget_test.g.dart. Potential outputs must be unique across all builders. See https://github.com/dart-lang/build/blob/master/docs/faq.md#why-do-builders-need-unique-outputs。
#52 后续问题查找
[+52383 ms] "flutter run" took 52,814ms.
[ +5 ms] pub finished with exit code 1
[ +1 ms]
#0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1 _DefaultPub.interactively (package:flutter_tools/src/dart/pub.dart:416:7)
#2 PackagesForwardCommand.runCommand (package:flutter_tools/src/commands/packages.dart:251:5)
#3 FlutterCommand.run. (package:flutter_tools/src/runner/flutter_command.dart:1161:27)
#4 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19)
#5 CommandRunner.runCommand (package:args/command_runner.dart:209:13)
#6 FlutterCommandRunner.runCommand. (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
#7 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19)
#8 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
#9 run.. (package:flutter_tools/runner.dart:62:9)
#10 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19)
#11 main (package:flutter_tools/executable.dart:94:3)
通过添加调试日志,发现两处空安全报错:
点个star鼓励作者,每个无私的开源贡献者都值得学习
对于系统的widget可以通过Function.apply()调用本地映射的方法还原,但是对于完全自定义的widget,如果在老版本中没有本地映射,如何根据下发的json还原?
tag name not supported yet you need to use @Fairbinding annotation to tag the local widget component
基于2.0.6版本dart2js转换静态方法不能正常生成js文件
环境:flutter 2.0.6版本 macos 12.0.1
问题:1.很多组件映射不成功,提示没有注册的type类型吗?2.build函数中的布局,提取出去函数但是带有参数传递怎么写?
例如,
1、InkWell is not register
2、ElevateButton is not register
3、type 'WarningWidget' is not a subtype of type is not a subtype of type ‘inputDecoration’
4、The following _TypeError was thrown while parsing widget of ListView.builder,
Closure: (dynamic) =>
ListView:
type '([dynamic]) => dynamic' is not a subtype of type '(BuildContext, int) =>
Widget'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.