在我的 flutter 应用程序中,我使用Firebase电话身份验证进行登录。总而言之,它完美地工作。通过使用我当前的代码,我必须在收到代码时明确添加短信代码。
如何在我的 Flutter 应用程序中自动进行此短信验证?
Future<void> _sendCodeToPhoneNumber() async {
final String phone = country + phoneNumberController.text;
final PhoneVerificationCompleted verificationCompleted =
(AuthCredential credential) {
setState(() {
print(
'Inside _sendCodeToPhoneNumber: signInWithPhoneNumber auto succeeded: $credential');
});
};
final PhoneVerificationFailed verificationFailed =
(AuthException authException) {
setState(() {
print(
'Phone number verification failed. Code: ${authException.code}. Message: ${authException.message}');
});
};
final PhoneCodeSent codeSent =
(String verificationId, [int forceResendingToken]) async {
this._verificationId = verificationId;
print("code sent to " + phone);
setState(() { …
Run Code Online (Sandbox Code Playgroud) ScreenShot我尝试为我的mac下载Xcode,在安装过程中我必须确认苹果开发者协议.但在同意条款和条件后,提交按钮没有响应.我使用的是OS 10.10.5和safari 10.0.2版本.所以我无法继续下载相同的内容.你能帮助我吗?
我必须将我的颤振应用程序中的图像直接发送到 whatsapp。启动whatsapp后,我想选择要分享图像的联系人。这在颤振中怎么可能?
我尝试使用 url_launcher,但它正在启动指定的联系人。而且我在任何地方都找不到共享选项。
const url = 'whatsapp://send?phone=$phone';
if (await URLLauncher.canLaunch(url)) {
await URLLauncher.launch(url);
}
else {
throw 'Could not launch $url';
}
Run Code Online (Sandbox Code Playgroud) 我有一个带有三张地图的 Json 结构,一个是产品列表,然后是总计和税收。我必须在颤振中解析这个 json 结构。我在模型类上创建。现在我在类型转换中遇到错误。
如何解决这个问题?
JSON 结构:
{
"products" : [
{
"cart_id": "7",
},
{
"cart_id": "7",
}
],
"total": 100,
"tax": 100
}
Run Code Online (Sandbox Code Playgroud)
模型类:
class CartModel {
List<Product> produtcts;
double total;
CartModel({this.produtcts, this.total});
factory CartModel.fromJson(Map<String, dynamic> json) {
var list = json['products'] as List;
print(list.runtimeType);
List<Product> products = list.map((i) =>
Product.fromJson(i)).toList();
return CartModel(
produtcts: products, total: json['total'],);
}
}
class Product {
String cartId;
Product({this.cartId,});
factory Product.fromJson(Map<String, dynamic> json) {
return Product(
productId: json['cart_id'],
);
}
}
Run Code Online (Sandbox Code Playgroud) 我有错误,如"错误:任务执行失败":app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:com/google/android/gms/internal/zzpm $ zza $ zza.class"
我该怎么做才能消除这个错误
gradle这个
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.user.merchant"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:design:23.2.0'
compile 'com.android.support:support-v4:23.2.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.google.android.gms:play-services-appindexing:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
//compile files('libs/google-play-services.jar')
}
Run Code Online (Sandbox Code Playgroud)