有没有办法在颤振中实现深层链接,以便如果用户单击链接,则他们被重定向到应用程序的特定部分,前提是应用程序已安装,但如果没有,则将它们重定向到相应的应用程序商店,安装应用程序,然后转到该特定部分?
在寻找解决方案时,我遇到了这个名为的包,uni_links但我不确定它是否可以满足此要求。
我最近使用 Ubuntu 从 Ubuntu 切换回带有适用于 Linux 的 Windows 子系统的 Windows。我想与 Flutter 取得联系,并希望能够在 Windows 上开发时将 bash 用于 Flutter 命令。这是可能的还是我应该只为 Windows 安装所有东西?。
我正在尝试使用插件位置获取设备的当前位置,但 Android 从不要求权限。我收到此错误:
发生异常。平台异常(平台异常(PERMISSION_DENIED_NEVER_ASK,位置权限永远被拒绝 - 请打开应用设置,空))
我在 Android 文件夹中可以找到的每个“AndroidManifest.xml”文件中都添加了以下行(不知道我实际上应该使用哪一个,我找到了其中的 3 个)
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
Run Code Online (Sandbox Code Playgroud)
我尝试使用插件permission_handler手动请求它们,但仍然没有弹出窗口。
我完全迷失了,我在网上找不到类似的东西。这是代码:
Future<LocationData> _getLocation() async {
LocationData currentLocation;
// returns a map with unreadable numbers which make no sense
var t = await PermissionHandler()
.requestPermissions([PermissionGroup.location]);
// returns false
var test = await location.requestPermission();
try {
currentLocation = await location.getLocation();
} catch (e) {
currentLocation = null;
}
return currentLocation;
}
Run Code Online (Sandbox Code Playgroud)
编辑:我在我的设备(OnePlus 6)和模拟器(Pixel XL API 28)上试过这个。我也尝试卸载/重新安装该应用程序。
在颤振中,我使用了一个 php 文件,该文件从 db 查询返回一个 json 响应,但是当我尝试解码 json 时,我收到此错误:
E/flutter ( 8294): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled
Exception: FormatException: Unexpected character (at character 1)
E/flutter ( 8294): [{"0":"PRUEBA","usu_nombre":"PRUEBA"}]
E/flutter ( 8294): ^
Run Code Online (Sandbox Code Playgroud)
这是我的飞镖功能:
Future<String> iniciarSesion() async{
var usuario = textUsuario.text;
var password = textPassword.text;
var nombreUsuario;
var url ="http://192.168.1.37/usuario.php";
//Metodo post
var response = await http.post(
url,
headers:{ "Accept": "application/json" } ,
body: { "usuario": '$usuario',"password": '$password'},
encoding: Encoding.getByName("utf-8")
);
List data = json.decode(response.body);
}
Run Code Online (Sandbox Code Playgroud)
和我的 php 文件中的代码:
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
include_once …Run Code Online (Sandbox Code Playgroud) 我已经在我的颤振项目中实现了signature_pad并且它工作正常。
不幸的是,当我把它放在里面时SingleChildScrollView,签名没有画出来。它滚动而不是签名。
似乎是,GestureDetector但我不知道如何解决它。
有人可以给我一些线索吗?
谢谢。
我正在将我的应用程序重构为 GetX 状态管理,以减少样板代码。 我制作了控制器和 API 提供者(下面的代码)。但是当我想刷新数据时(也是手动)它不会改变。
主页.dart
class HomeUI extends GetView<HomeController> {
...
GetX<HomeController>(
initState: (state) => Get.find<HomeController>().getAll(),
builder: (_) {
return _.goalList.length < 1 ||
_.goalList == null
? Center(
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
CircularProgressIndicator(),
Text('0 goals found, please wait',
style: Theme.of(context)
.textTheme
.headline6
.copyWith(
color: kTextColor))
],
))
: ListView.builder(
itemBuilder: (context, index) {
GoalModel goalModel =
GoalModel.fromMap(
_.goalList[index]);
return ListTile(
title: Text(goalModel.text),
subtitle:
Text(goalModel.updated_at),
);
});
}
Run Code Online (Sandbox Code Playgroud)
home_controller.dart
class HomeUI extends GetView<HomeController> {
...
class …Run Code Online (Sandbox Code Playgroud) 我需要将 JSON 解析为对象并在我的应用程序中使用它,但我需要使用 dio 库来执行此操作,但我是新手,有人可以帮助我如何使用它来将 JSON 解析为对象,这也是我的请求需要一个令牌,我的对象将像这样锁定:
import 'dart:convert';
Users usersFromJson(String str) => Users.fromJson(json.decode(str));
String usersToJson(Users data) => json.encode(data.toJson());
class Users {
Users({
this.data,
});
List<Datum> data;
factory Users.fromJson(Map<String, dynamic> json) => Users(
data: List<Datum>.from(json["data"].map((x) => Datum.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"data": List<dynamic>.from(data.map((x) => x.toJson())),
};
}
class Datum {
Datum({
this.id,
this.name,
this.email,
this.phone,
this.status,
this.images,
});
int id;
String name;
String email;
String phone;
String status;
List<Image> images;
factory Datum.fromJson(Map<String, dynamic> json) => Datum(
id: json["id"], …Run Code Online (Sandbox Code Playgroud) 我正在寻找如何在 GetX 的最佳实践中处理表单和验证的示例?有没有很好的例子,或者有人可以向我展示我们如何最好地做到这一点的例子?
我正在尝试在 iPhone 上测试 Flutter 应用程序,但出现如下所示的错误,此错误发生在构建步骤期间。
error: No profiles for 'xxx' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'xxx'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. (in target 'Runner' from project 'Runner')
Run Code Online (Sandbox Code Playgroud)
在运行时我面临这个错误
Launching lib/main.dart on Test’s iPhone in debug mode...
Warning: Missing build name (CFBundleShortVersionString).
Warning: Missing build number (CFBundleVersion).
Automatically signing iOS for device deployment using specified development team in Xcode project: FF3XTSVPAA …Run Code Online (Sandbox Code Playgroud) 我有一个来自客户的现有项目,我尝试在我的 Mac 上运行它,但是当我尝试运行该项目时,我遇到了以下错误
有关错误的更多详细信息:
Xcode build done. 20.5s
Failed to build iOS app
Error output from Xcode build:
?
2020-12-28 09:53:09.348 xcodebuild[5722:80049] DTDeviceKit: deviceType from 49f62dac6f1da634e5d71981db4d591dc9126e4b was NULL
2020-12-28 09:53:09.449 xcodebuild[5722:80049] DTDeviceKit: deviceType from 49f62dac6f1da634e5d71981db4d591dc9126e4b was NULL
** BUILD FAILED **
Xcode's output:
?
/Users/pkimac/Library/Developer/Xcode/DerivedData/Runner-dyvnmbcstcyeklavxcvptjfbuuka/Build/Intermediates.noindex/Runner.build/Debug-iphoneos/Runner.build/Script-9FEDFCA313C1B9E0CFFDF6D8.sh: line 2: /Users/pkimac/Desktop/rto_exam_gujarati 2/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh: Permission denied
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Planning build
note: Constructing build description
Could not build the precompiled application for …Run Code Online (Sandbox Code Playgroud) flutter ×10
dart ×4
getx ×2
ios ×2
android ×1
api ×1
bloc ×1
deep-linking ×1
dio ×1
flutter-ios ×1
forms ×1
http ×1
iphone ×1
json ×1
permissions ×1
podfile ×1
signature ×1
validation ×1
windows ×1
windows-subsystem-for-linux ×1
xcode ×1