步骤我是如何实施的。
按照建议,我一直实施。在调试模式下它非常好。不幸的是,即使我在 firebase 控制台中添加了调试和释放 sha1 密钥,它也无法在发布模式下工作。
步骤 1. 编码部分在这里
final PhoneVerificationCompleted verificationCompleted =
(PhoneAuthCredential user) {
successMessage('Your phone number verified successfully!');
_loginNotifier.validate();
};
final PhoneVerificationFailed verificationFailed = (FirebaseAuthException authException) {
errorMessage('Phone number verification failed. Code: ${authException.code}. Message: ${authException.message}');
print(
'Phone number verification failed. Code: ${authException.code}. Message: ${authException.message}');
};
final PhoneCodeAutoRetrievalTimeout codeAutoRetrievalTimeout =
(String verificationId) {
this._verificationId = verificationId;
print("time out");
};
firebaseAuth = FirebaseAuth.instance;
firebaseAuth.verifyPhoneNumber(
phoneNumber: '+$_phoneWithCC',
timeout: const Duration(seconds: 60),
verificationCompleted: verificationCompleted,
verificationFailed: verificationFailed,
codeSent: codeSent,
codeAutoRetrievalTimeout: codeAutoRetrievalTimeout);
Run Code Online (Sandbox Code Playgroud)
第2步: …
我有一个像下面这样的对象,
class LocationData{
String time;
String name;
String address;
}
Run Code Online (Sandbox Code Playgroud)
对于这个对象,我创建了 getter setter。
通过使用服务,我填写了上述模型并保存到房间数据库中。每当用户打开我的应用程序时,我只是使用 API 将房间数据库数据更新到服务器。现在有时会发生时间重复。如何根据时间从数组中删除对象。时间应该是唯一的。