我的颤振项目无法在 ios 设备上运行。我试过下面的命令sudo gem install cocoapods。
颤动运行:
Warning: CocoaPods not installed. Skipping pod install.
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.
To install:
sudo gem install cocoapods
pod setup
Running Xcode build...
Xcode build done. 4.3s
Failed to build iOS app
Error output from Xcode build:
?
** BUILD FAILED **
Xcode's …Run Code Online (Sandbox Code Playgroud) 鉴于下面的短代码示例:
...
print("1 parsing stuff");
List<dynamic> subjectjson;
try {
subjectjson = json.decode(response.body);
} on Exception catch (_) {
print("throwing new error");
throw Exception("Error on server");
}
print("2 parsing stuff");
...
Run Code Online (Sandbox Code Playgroud)
我希望在解码失败时执行 catch 块。但是,当返回错误响应时,终端会显示异常,并且不会触发 catch 和继续代码......
flutter: 1 parsing stuff
[VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: type
'_InternalLinkedHashMap<String, dynamic>' is not a subtype of type
'List<dynamic>'
Run Code Online (Sandbox Code Playgroud)
我在这里缺少什么?
I'm trying to build my app on the ios simulator(ios 13), but the build fails and gives an error of pod files: Podfile is out of date
This is the error.
Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Warning: Podfile is out of date
This can cause a mismatched version of Flutter to be embedded in your app, which may result in App Store submission rejection or crashes.
If you have local Podfile edits you would like …Run Code Online (Sandbox Code Playgroud) 创建新的 Android Studio 项目在 Gradle 构建文件中出现以下异常:
Cannot resolve symbol 'GradleException'
Run Code Online (Sandbox Code Playgroud)
Gradle 仍然成功构建,但仍然在编辑器中显示此错误。
我的项目缺少什么?
安卓工作室 3.3.2
摇篮 4.10.1
compileSdkVersion 27
我正在尝试在 Flutter 中创建一个下拉按钮。我从我的数据库中获取一个列表,然后我将列表传递给我的dropdownButton 所有工作,数据按预期显示,但是当我从中选择一个元素时,我收到此错误:
There should be exactly one item with [DropdownButton]'s value: Instance of 'Tag'.
Either zero or 2 or more [DropdownMenuItem]s were detected with the same value
'package:flutter/src/material/dropdown.dart':
Failed assertion: line 805 pos 15: 'items == null || items.isEmpty || value == null ||
items.where((DropdownMenuItem<T> item) {
return item.value == value;
}).length == 1'
Run Code Online (Sandbox Code Playgroud)
我尝试将DropdownButton 值设置为 null它可以工作,但随后我看不到所选元素。
这是我的代码:
FutureBuilder<List<Tag>>(
future: _tagDatabaseHelper.getTagList(),
builder: …Run Code Online (Sandbox Code Playgroud) dart drop-down-menu flutter dropdownbutton flutter-futurebuilder
我试图从 API 中获取一个列表,它是两种方法 fetchImages 和 fetchCategories。第一次显示红屏错误,然后在 2 秒后自动加载列表。你能告诉我我的代码有什么问题以及如何避免在我的应用程序中显示红屏错误吗?
Widget build(context) {
try{
if (isFirst == true) {
fetchImage();
fetchCategories(context);
isFirst = false;
}
}catch(Exception){
}
return MaterialApp(
home: Scaffold(
backgroundColor: Colors.black,
appBar: AppBar(
title: Text('Lets see images!'),
),
body: new Column(
children: <Widget>[
new Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new InkResponse(
child: new Column(
children: <Widget>[
Padding(
padding: EdgeInsets.all(10.0),
child: new Image.asset(
catimages[0],
width: 60.0,
height: 60.0,
),
),
new Text(
categoriesText[0],
style: TextStyle(color: Colors.white),
),
],
),
onTap: () …Run Code Online (Sandbox Code Playgroud) 我尝试了几种不同的方法,但我无法让它发挥作用。我想要实现的布局非常简单,在原生 Android 中实现起来轻而易举:
我尝试使用SingleChildScrollView,但它似乎在Column. 也许我做错了什么,或者我没有使用正确的小部件......
我的结果:
Scaffold(
body: Column(
children: <Widget>[
Container(
height: 100.0,
color: Colors.blue,
),
SingleChildScrollView(
child: Container(
color: Colors.red,
padding: EdgeInsets.all(20.0),
child: Column(
children: <Widget>[
Text('Red container should be scrollable'),
Container(
width: double.infinity,
height: 700.0,
padding: EdgeInsets.all(10.0),
color: Colors.white.withOpacity(0.7),
child: Text('I will have a column here'),
)
],
),
),
),
],
),
)
Run Code Online (Sandbox Code Playgroud) 如何删除.pub-cache文件夹中的flutter包?当我们给出时flutter clean,它将删除当前目录中的构建文件夹。我们可以手动删除它,但我的要求是.pub-cache使用命令删除文件夹中的包。
我正在开发一个颤振应用程序,项目运行完美,但突然项目没有运行,它给了我一个错误。
这是我尝试运行应用程序时收到的错误代码
Compiler message:
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/extended_image-0.7.2/lib/src/gesture/extended_image_slide_page_route.dart:333:9: Error: No named parameter with the name 'animation'.
animation: animation,
^^^^^^^^^
/C:/flutter/packages/flutter/lib/src/cupertino/route.dart:435:3: Context: Found this candidate, but the arguments don't match.
CupertinoFullscreenDialogTransition({
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.15.0/lib/src/picture_stream.dart:92:3: Error: The superclass, 'Diagnosticable', has no unnamed constructor that takes no arguments.
PictureStream();
^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.15.0/lib/src/picture_stream.dart:192:16: Error: The superclass, 'Diagnosticable', has no unnamed constructor that takes no arguments.
abstract class PictureStreamCompleter extends Diagnosticable {
^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/extended_image-0.7.2/lib/src/gesture/extended_image_slide_page_route.dart:333:9: Error: No named parameter with the name 'animation'.
animation: animation,
^^^^^^^^^
/C:/flutter/packages/flutter/lib/src/cupertino/route.dart:435:3: Context: Found this candidate, …Run Code Online (Sandbox Code Playgroud) 我对 iOS 非常陌生,完全没有 iOS 开发经验,但是,我接到了一个与preparing for iOS 14+. 根据我发现的https://support.google.com/admanager/answer/9997589,为了确保收入没有损失,我需要做两件事。
我遵循了一些指南,现在正在处理将 加入AppTrackingTransparency permission到 iOS 应用程序的问题。这是我正在使用的指南, https://developers.google.com/admob/ios/ios14#swift。
我设法添加了如下所示的键/值 Info.plist
<key>NSUserTrackingUsageDescription</key>
<string>This identifier will be used to deliver personalized ads to you.</string>
Run Code Online (Sandbox Code Playgroud)
但这是我希望得到一些帮助的地方。我认为我仍然需要在某处添加代码以使用 AppTrackingTransparency 请求用户许可。根据指南,我认为需要以下代码来显示App Tracking Transparency dialog box. Question 1,我的假设正确吗?
import AppTrackingTransparency
import AdSupport
...
func requestIDFA() {
ATTrackingManager.requestTrackingAuthorization(completionHandler: { status in
// Tracking authorization …Run Code Online (Sandbox Code Playgroud)