我收到以下错误:
/Users/flo/.pub-cache/hosted/pub.dartlang.org/image_picker-0.6.7+12/ios/Classes/FLTImagePickerPlugin.m:1
49:20: warning: 'UIAlertView' is deprecated: first deprecated in iOS 9.0 - UIAlertView is deprecated.
Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead
[-Wdeprecated-declarations]
[[[UIAlertView alloc] initWithTitle:@"Error"
Run Code Online (Sandbox Code Playgroud)
我已经尝试做:
flutter pub cache repair
rm .pub-cache/hosted/pub.dartlang.org 目录
rm podfile.lock 和 Pods 文件夹
但还是同样的问题。有任何想法吗 ?我只为 Swift 发现了这样的问题,但与 Flutter 无关。
在 github 和 stack 上搜索了很长时间以查找类似错误后,没有一个建议的解决方案帮助我解决此错误。
我尝试了很多东西(有点乱):
这是错误:
** BUILD FAILED **
Xcode's output:
?
/Users/flo/Mobile/we_ll_see/ios/Runner/GeneratedPluginRegistrant.m:10:9: fatal error: module
'cloud_firestore' not found
@import cloud_firestore;
~~~~~~~^~~~~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Run Code Online (Sandbox Code Playgroud)
需要一些帮助的家伙
我想从用户卡直接转账到关联帐户。为此,我必须指示 source_transaction 字段。
await stripe.transfers.create({
amount: amount,
currency: "eur",
destination: "{connected_account1}",
transfer_group: "{ORDER1}",
source_transaction: // How to get this information ?
});
Run Code Online (Sandbox Code Playgroud)
这是我从我的应用程序(PaymentMethod)获得的信息:
我需要做什么才能获取source_transaction我在 PaymentMethod 对象上获得的信息?
我想测试管理我的表单的控制器流。在这里,我尝试测试连接到验证器的电子邮件控制器。
我设法通过接收器方法添加控制器值并通过流方法恢复。
宣言
final emailController = BehaviorSubject<String>();
Stream<String> get email => emailController.stream.transform(validateEmail);
Function(String) get changeEmail => emailController.sink.add;
Run Code Online (Sandbox Code Playgroud)
验证器进行测试
final validateEmail =
StreamTransformer<String, String>.fromHandlers(handleData: (email, sink) {
final emailRegExp = new RegExp(
r"^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,253}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,253}[a-zA-Z0-9])?)*$",
caseSensitive: false,
multiLine: false,
);
emailRegExp.hasMatch(email).toString();
if (email.contains('@')) {
sink.add(email);
} else {
sink.addError('Enter a valid email');
}
});
Run Code Online (Sandbox Code Playgroud)
单元测试
void main() {
UserProfilEditBloc userProfilEditBloc = new UserProfilEditBloc();
test('Email check BehaviorSubject', () {
userProfilEditBloc.changeEmail('testtest'); //Expected @
expect(userProfilEditBloc.email, emits('Enter a valid email'));
});
}
Run Code Online (Sandbox Code Playgroud)
错误信息
00:02 +0 -1: Email …Run Code Online (Sandbox Code Playgroud) 我在 Flutter 中开发了一个应用程序,其中有很多不同的动画。我想通过分离视图、逻辑(模型 BLoC)和动画来构建我的代码。对于这个问题,我尝试为 StatefulWidget 的不同类中的按钮声明多次相同的动画。
但是,我陷入困境,因为我必须将 TickerProvider 传递给我的动画类,而我没有以正确的方式执行此操作。
构造函数动画类
AppBloc(TickerProvider tickerProvider) {
banimationController = AnimationController(
vsync: tickerProvider,
duration: Duration(milliseconds: 100),
lowerBound: 0,
upperBound: 0.05,
);
}
Run Code Online (Sandbox Code Playgroud)
宣言
AppBloc(this);
Run Code Online (Sandbox Code Playgroud)
我知道这可能不是正确的方法,我编写了这段代码来说明我的问题。
我只想将我的动画声明分离到另一个文件中。
更新 Flutter 2 后,我无法再在 IOS 上部署应用程序:
\nWarning: CocoaPods minimum required version 1.9.0 or greater not installed.\nSkipping pod install.\n CocoaPods is used to retrieve the iOS and macOS platform side\'s plugin code\n that responds to your plugin usage on the Dart side.\n Without CocoaPods, plugins will not work on iOS or macOS.\n For more info, see https://flutter.dev/platform-plugins\nTo upgrade see\nhttps://guides.cocoapods.org/using/getting-started.html#installation for\ninstructions.\n\nCocoaPods not installed or not in valid state.\nError launching application on iPhone 11.\nRun Code Online (Sandbox Code Playgroud)\n我尝试使用 Flutter 项目中的 cloud_functions 插件调用我的云函数,代码如下:
\nfinal HttpsCallable callable = new CloudFunctions(region: "europe-west3")\n .getHttpsCallable(functionName: 'helloWorld');\n\ndynamic resp = await callable.call(<String, dynamic>{'id': id, 'chatId': chat.chatId});\nRun Code Online (Sandbox Code Playgroud)\n并得到以下错误:
\nERROR: PlatformException(3840, The data couldn\xe2\x80\x99t be read because it isn\xe2\x80\x99t in the correct format., null)\nRun Code Online (Sandbox Code Playgroud)\n通过我的研究,我发现当您忘记将区域放在服务器和客户端上时,可能会出现问题,但错误仍然存在。
\n我还尝试传递成功的 http 请求:
\nvar parameters = {'id': id, 'chatId': chat.chatId};\nvar url = "https://europe-west3-{MY_DOMAIN}.cloudfunctions.net/helloWorld";\nawait http.post(url, body: parameters).then((res) {...}\nRun Code Online (Sandbox Code Playgroud)\n所以我认为问题出在插件上,我可能忘记了一些东西。有任何想法吗 ?
\n云功能(测试):
\nexports.helloWorld = functions\n .region('europe-west3')\n .https.onRequest((request, response) => {\n try {\n response.send('Hello from …Run Code Online (Sandbox Code Playgroud) 通过将 DateTime 对象从应用程序直接发送到 Firebase,会自动转换为 TimeStamp 格式。但是,如果我通过云函数发送相同的对象,我将收到以下错误:
Invalid argument: Instance of 'DateTime'
Run Code Online (Sandbox Code Playgroud)
我尝试使用该toString()方法传递对象并通过运行 Date.parse 进行后端转换Date.parse(data["birth_date"])。但在 Firestore 上,数据记录为数字而不是时间戳。
颤振代码:
//final DateTime birthDate; -> To show you the type
final HttpsCallable callable =
CloudFunctions(region: "europe-west3").getHttpsCallable(
functionName: 'userFunctions-editUser',
);
HttpsCallableResult httpsCallableResult =
await callable.call({"birth_date": birthDate});
Run Code Online (Sandbox Code Playgroud)
服务器端代码:
exports.addUser = functions
.region("europe-west3")
.https.onCall((data, context) => {
const userUid = data["userUid"];
const docRef = admin.firestore().doc(`/users_profils/${userUid}`);
return docRef.set({
...
birth_date: Date.parse(data["birth_date"]),
...
});
});
Run Code Online (Sandbox Code Playgroud)
如何使用云函数将 DateTime 对象转换为 TimeStamp ?
firebase flutter google-cloud-functions google-cloud-firestore