我有int一个长度为 3 的列表
这是清单:
List<Tamount> integer= [
amount(amount: 2, id: '34'),
amount(amount: 4, id: '12'),
TotalAmount(amount: 2, id: '54'),
];
Run Code Online (Sandbox Code Playgroud)
我想替换索引 2,所以数量为 4
我试过这个:
List<Tamount> integer= [
amount(amount: 2, id: '34'),
amount(amount: 4, id: '12'),
TotalAmount(amount: 2, id: '54'),
];
Run Code Online (Sandbox Code Playgroud)
但它不起作用,出于某种原因,它没有将其从列表中删除,而是添加到列表中。
他们三个基本上做同样的事情。最佳实践是什么?什么情况下应该使用哪种提取方式?标准是什么?
我想这些可能是一些重要的点:
提取容器。您更喜欢哪种方式?为什么?
class Example extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container();
}
}
Run Code Online (Sandbox Code Playgroud)
class Example extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ExtractedAsWidget();
}
}
class ExtractedAsWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container();
}
}
Run Code Online (Sandbox Code Playgroud)
class Example extends StatelessWidget {
@override
Widget build(BuildContext context) {
return buildContainer();
}
Container buildContainer() => Container();
}
Run Code Online (Sandbox Code Playgroud)
class Example extends StatelessWidget {
@override …Run Code Online (Sandbox Code Playgroud) 我想完全理解这个命令以及幕后发生的事情。以下是我到目前为止所了解的一些信息,但不知何故我无法将这些点联系起来:
flutter build ios会创建一个 build/ios 文件夹,包括 Release-iphoneos/Runner.app
现在,问题:
flutter build ios之前不跑步会怎样?Xcode 会只使用我的应用程序的调试模式吗?如果是这样,它如何删除右上角的调试标志?

flutter build ios之前运行,为什么不直接从 Xcode 存档?感谢所有试图为我和其他想知道的人解开这个大谜团的人。
使用小部件的初始方法的经验法则是什么?我应该使用:
根据我的测试,两者似乎都有效。在代码减少方面,似乎 B. 方法更好、更短、更干净、更具可读性。性能方面又如何呢?还有什么我可能会错过的吗?
有谁知道出了什么问题吗?我正在尝试完成第一步:1.将身份验证链接发送到用户的电子邮件地址(根据文档:https: //firebase.google.com/docs/auth/flutter/email-link-auth)
这是我的功能:
@override
Future<String> signInWithEmail(String email) async {
var acs = ActionCodeSettings(
// URL you want to redirect back to. The domain (www.example.com) for this
// URL must be whitelisted in the Firebase Console.
url: 'https://myweb.app',// I'm using the real URL
// This must be true
handleCodeInApp: true,
iOSBundleId: 'com.company.app', // I'm using the real iOSBundleId
// androidPackageName: 'com.example.android',
// installIfNotAvailable
// androidInstallApp: true,
// minimumVersion
// androidMinimumVersion: '12'
);
// try {
await …Run Code Online (Sandbox Code Playgroud) authentication dart firebase firebase-authentication flutter
flutter cleanflutter build ios我究竟做错了什么?如何强制 Xcode 从 CLI 或 pubspec.yaml 更新我的版本?
这是我的 Info.plist 的样子:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Name</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Sundee</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Your location will be used to determine sun angle.</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Your location will be used to determine sun angle.</string> …Run Code Online (Sandbox Code Playgroud) 我想 firebase 不太喜欢嵌套,但他们也说(如果我理解正确的话)一级嵌套是可以的。
让我们看一个餐厅和 2 个不同场景的示例:
Flat:无嵌套(无子集合)
/restaurants
-mealCategoriesID: List<DocumentReference>
-mealsID: List<DocumentReference>
/meal_categories
/meals
-mealCategoryID: DocumentReference
Run Code Online (Sandbox Code Playgroud)
深:筑巢
/restaurants/meal_categories/meals
Run Code Online (Sandbox Code Playgroud)
那么,在这个餐厅示例中最好的方法是什么?
我知道如何在构造函数中初始化其他变量,例如 int 或 String,但我不知道如何为 List 和 Map 执行此操作。
class StackOverFlowQuestion{
StackOverFlowQuestion({this.test='', this.map=?, this.list=?});
String test;
Map map;
List list;
}
Run Code Online (Sandbox Code Playgroud)
我应该用什么代替问号?
谢谢。
flutter ×7
dart ×5
deployment ×2
firebase ×2
ios ×1
null ×1
optimization ×1
performance ×1
refactoring ×1
xcode ×1