I want to extract a number (integer, decimal or 12:30 formats) from a string. I have used the following RegEx but to no avail:
final RegExp numberExp = new RegExp(
"[a-zA-Z ]*\\d+.*",
caseSensitive: false,
multiLine: false
);
final RegExp numberExp = new RegExp(
"/[+-]?\d+(?:\.\d+)?/g",
caseSensitive: false,
multiLine: false
);
String result = value.trim();
result = numberExp.stringMatch (result);
result = result.replaceAll("[^0-9]", "");
result = result.replaceAll("[^a-zA-Z]", "");
Run Code Online (Sandbox Code Playgroud)
So far, nothing works perfectly.
Any help appreciated.
已经尝试了好几天了;谷歌搜索并尝试各种“修复”和“依赖项”等,但仍然无法构建 APK 进行发布。调试没问题。
我的命令:flutter build apk --release 错误:AILURE:构建失败并出现异常。
com.android.tools.r8.CompilationFailedException:编译未能完成
在 2m 1s 内构建失败
运行 Gradle 任务 'assembleRelease'...
运行 Gradle 任务 'assembleRelease'... 完成 147.3s (!) [!] 收缩器可能无法优化 Java 字节码。要禁用收缩器,请将--no-shrink
标志传递给此命令。要了解更多信息,请参阅: https: //developer.android.com/studio/build/shrink-code
Gradle 任务 assembleRelease 失败,退出代码 1
构建.等级(应用程序):
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the …
Run Code Online (Sandbox Code Playgroud) 我一直在尝试解决构建问题几个小时,直到我意识到这是由于 Flutter 插件 cloud_firestore。0.7.4 版本适用于 Android 和 iOS,但任何高于 0.7.4 的版本(如 0.8.2+1)都会出现错误,例如:
CloudFirestorePlugin.java:160: 错误:找不到符号 query = query.whereArrayContains(fieldName, value); ^ 符号:方法 whereArrayContains(String,Object) 位置:查询类型的变量查询 /dev/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.8.2+1/android/src/main/java /io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java:598: 错误:找不到符号 builder.setTimestampsInSnapshotsEnabled( ^ 符号:方法 setTimestampsInSnapshotsEnabled(Boolean) 位置:类型为 Builder /dev/flutter/.pub-cache 的变量构建器/hosted/pub.dartlang.org/cloud_firestore-0.8.2+1/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java:678:错误:找不到符号返回字段值。arrayUnion(toArray(readValue(buffer))); ^ 符号:方法 arrayUnion(Object[]) 位置:类 FieldValue /dev/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.8.2+1/android/src/main/java/io/ flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java:680: 错误:找不到符号 return FieldValue.arrayRemove(toArray(readValue(buffer))); ^ 符号:方法 arrayRemove(Object[]) 位置:类 FieldValue 注意:/Users/peterlumdev/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.8.2+1/android/src/main/ java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java 使用未经检查或不安全的操作。注意:使用 -Xlint:unchecked 重新编译以获取详细信息。4 个错误 FAILURE:构建失败,出现异常。* 什么地方出了错:
编译失败;有关详细信息,请参阅编译器错误输出。* 尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。使用 --scan 运行以获得完整的见解。* 在https://help.gradle.org获得更多帮助在 11 秒内构建失败 Gradle 任务 assembleDebug 失败,退出代码为 1
我想为 ios 和 Android 使用 …
如何返回QuerySnapshot作为Future >>?
程式码片段:
Future <List<Map<dynamic, dynamic>>>() {
List<Map<dynamic,dynamic>> list;
.....
.....
QuerySnapshot collectionSnapshot = await collectionRef.getDocuments();
list = collectionSnapshot.documents; <--- ERROR
return list;
}
Run Code Online (Sandbox Code Playgroud)
我认为我需要使用的Map,但无法绕开它。
我发现Flutter / Dart有行为。我正在尝试调整ImagePicker中的图像大小。该模拟器运行良好,但在实际设备(iPhone 6 plus)上,整个过程耗时超过10分钟,并以崩溃告终。
在实际的设备上,我单击了带出“图像选择器”的按钮,选择了一张照片,设备刚刚挂起。10分钟后,图像密码器将关闭,并继续调整图像大小,大约5分钟后,图像崩溃。
这是代码:
ImagePicker.pickImage(source: source)
.then((_imageFile2) => _uploadFile(_imageFile2)
.then((downbloadURL) {
if (downbloadURL != null ) {
createCloudStoreRecord(fireBaseUser, downbloadURL, true);
setState(() {
profileImage = new DecorationImage(
image: getProfileImage(downbloadURL),
fit: BoxFit.cover,
);
});
Navigator.pop(context);
showInSnackBar("Image Updated");
} else {
Navigator.pop(context);
showInSnackBar("Image Update Error!");
}
}));
Future<String> _uploadFile(_imageFile2) async {
print("in upload image");
if (_imageFile2==null) {
print("imagePicker image is null");
Navigator.pop(context);
return null;
} else {
onLoading(context, "Updating ...");
try {
// resize image
Im.Image image = Im.decodeImage(_imageFile2.readAsBytesSync());
Im.Image …
Run Code Online (Sandbox Code Playgroud)