我注意到我的项目中出现了新的 lint 问题。
长话短说:
我需要在我的自定义类中使用 BuildContext
flutter lint 工具与 aysnc 方法一起使用时并不满意。
例子:
MyCustomClass{
final buildContext context;
const MyCustomClass({required this.context});
myAsyncMethod() async {
await someFuture();
# if (!mounted) return; << has no effect even if i pass state to constructor
Navigator.of(context).pop(); # << example
}
}
Run Code Online (Sandbox Code Playgroud) dart flutter flutter-dependencies flutter-state flutter-build
我已经创建了 flutter 应用程序,现在想要创建存档以便在 Xcode 14.3 中分发。
问题
PhaseScriptExecution failed with a nonzero exit code已经尝试过了
注意 转到“钥匙串访问”。从禁用的登录选项中再次选择“锁定和解锁”。如何启用它?
期待您的帮助。
Podfile
# Uncomment this line to define a global platform for your project
platform :ios, '12.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root …Run Code Online (Sandbox Code Playgroud) 我正在尝试采用 Flutter 项目的 iOS 版本。无论我尝试什么,它都会给我以下错误:
错误:找不到构建输入文件:“/Users/GoogleService-Info.plist”(在项目“Runner”的目标“Runner”中)
这是我尝试使用以下命令进行构建的一组命令:
这是我的颤振医生输出
Doctor summary (to see all details, run flutter doctor -v):
[?] Flutter (Channel master, v1.16.3-pre.67, on Mac OS X 10.15.3 19D76, locale en-GB)
[?] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[?] Xcode - develop for iOS and macOS (Xcode 11.4)
[?] Android Studio (version 3.5)
[?] VS Code (version 1.43.2)
[!] Connected device
! Doctor found issues in 1 category.
Run Code Online (Sandbox Code Playgroud)
在flutter …
我正在使用EasyLocalization、等mobx。JsonSerializable为了生成*.g.dart文件,我正在使用build_runner watch或 中的脚本 scripts/build.sh:
flutter packages pub run build_runner build
Run Code Online (Sandbox Code Playgroud)
最多也就两秒,但突然间就开始至少需要十秒,有时甚至是三十秒。由于这种情况,build_runner watch变得毫无用处,我的意思是从那时起它就不能正常工作了。
当我运行脚本时控制台上的输出:
$ sh scripts/build.sh
[INFO] Generating build script...
[INFO] Generating build script completed, took 611ms
[INFO] Initializing inputs
[INFO] Reading cached asset graph...
[INFO] Reading cached asset graph completed, took 126ms
[INFO] Checking for updates since last build...
[INFO] Checking for updates since last build completed, took 745ms
[INFO] …Run Code Online (Sandbox Code Playgroud) 之后flutter build ios --release,它被卡住了pod install,导致运行 pod install 时出错:
Running pod install... 954ms\nCocoaPods' output:\n\xe2\x86\xb3\n Preparing\n\n Analyzing dependencies\n\n Inspecting targets to integrate\n Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)\n\n Finding Podfile changes\n - Flutter\n - app_settings\n - biometric_storage\n - blinkid_flutter\n - camera\n - contacts_service\n - device_info_plus\n - firebase_core\n - firebase_messaging\n - flutter_biometrics\n - flutter_inappwebview\n - flutter_local_notifications\n - flutter_native_timezone\n - flutter_secure_storage\n - flutter_zendesk_chat\n - geocoding\n - geolocator_apple\n - google_ml_kit\n - image_gallery_saver\n - in_app_review\n …Run Code Online (Sandbox Code Playgroud) 在调试模式下构建适用于 Windows 的 Flutter 应用程序时,会发生此错误。flutter doctor -v给出正常输出。这可能是什么原因造成的?
Launching lib\main.dart on Windows in debug mode...
lib\main.dart:1
LINK : fatal error LNK1168: cannot open F:\{project-name}\build\windows\runner\Debug\{project-name}.exe for writing [F:\{project-name}\build\windows\runner\{project-name}.vcxproj]
Exception: Build process failed.
Exited (sigterm)
Run Code Online (Sandbox Code Playgroud) 我想用来MediaQuery根据屏幕高度和宽度构建小部件。#26004中也提到了这个问题,即我只想查询一次大小数据,例如在initState. MediaQuery文档状态
使用 MediaQuery.of 查询当前媒体将导致您的小部件在 MediaQueryData 更改时自动重建(例如,如果用户旋转其设备)。
,但这会导致我的应用程序进行不必要的重建。具体来说,如果插入或填充发生更改(例如显示键盘时),它会导致小部件重建。
有没有一种替代方案MediaQuery可以在更改时不会导致重建MediaQueryData?
我有一个非常奇怪的问题,我无法解决:我想在我的 iPhone 上测试我的应用程序,并在一天中的不同位置测试应用程序。所以我需要制作一个配置文件或发布版本才能在我的手机上安装该应用程序。调试模式运行良好,我在屏幕上正确显示了所有 UI 元素。但是,在配置文件和发布模式下,主屏幕 UI 的一半未显示。我在 Grid 视图中有一些 Card-Widgets,下面是一个 Divider-Widget,下面有另一个 Card-Gridview。所有这些都没有显示。我在使用华为的 Windows 上也遇到了这个问题。只有调试模式才能正常工作。你对如何解决它有什么想法吗?
我正在我的应用程序中使用geolocator和Permission_handler包,但现在这两个包分别有不同compileSdkVersion的30要求31。我正在尝试更改compileSdkVersion,但它不再工作
现在如果我切换到 30 则会出现以下错误
Launching lib\main.dart on INE LX1r in debug mode...
Parameter format not correct -
Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\contacts_service-0.4.6\android\src\main\java\flutter\plugins\contactsservice\contactsservice\ContactsServicePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.2.5\android\src\main\java\com\baseflow\permissionhandler\PermissionManager.java:321: error: cannot find symbol
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
^
symbol: variable S
location: class VERSION_CODES
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.2.5\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:72: error: cannot find symbol
case Manifest.permission.BLUETOOTH_SCAN:
^
symbol: variable BLUETOOTH_SCAN
location: class permission
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.2.5\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:74: error: cannot find symbol
case Manifest.permission.BLUETOOTH_ADVERTISE:
^ …Run Code Online (Sandbox Code Playgroud) 当我运行命令时
flutter build ipa --export-options-plist=<my_plist.plist>
Run Code Online (Sandbox Code Playgroud)
尽管我已将signingStyle 设置为手动,并在导出选项plist 中指定了证书和配置文件,Flutter 仍然尝试使用 xcode 项目中指定的详细信息自动签署构建。
当尝试在 azure 管道中构建时,这会导致生成错误,因为项目文件中指定的证书未安装在 Mac 代理上。
运行时是否可以指定手动签名
flutter build ipa
Run Code Online (Sandbox Code Playgroud)