我在颤振宽度扩展过滤器中使用扩展 file_picker
try {
result = await FilePicker.platform.pickFiles(
type: FileType.custom,
allowedExtensions: ['jpeg', 'jpg', 'heic', 'pdf'],
);
} catch (e) {
print('fileSelector ****${e}***');
}
Run Code Online (Sandbox Code Playgroud)
但在 Android 中,我可以选择任何扩展名的所有文件。在 IOS 中这个过滤器工作得很好。这是一个错误file_picker还是我必须做一些额外的事情?
我使用包 http: ^ 0.12.2
这是我的港口
import 'package: http / http.dart' as http;
import 'dart: io';
import 'dart: convert';
Run Code Online (Sandbox Code Playgroud)
用于从服务器检索数据。它适用于 Android 和 iOS。但在网络上我收到错误消息 Unsupported operation: Platform._version
这是我的功能:
Future getUserData() async {
var url_ = "${APIDomain}/antragsteller/1";
HttpClient client = new HttpClient();
client.badCertificateCallback =
((X509Certificate cert, String host, int port) => true);
HttpClientRequest request = await client.getUrl(Uri.parse(url_));
request.headers.set('content-type', 'application/json');
request.headers.set('Access-Control-Allow-Origin', '*');
HttpClientResponse response = await request.close();
String reply = await response.transform(utf8.decoder).join();
this.userData = jsonDecode(reply);
}
Run Code Online (Sandbox Code Playgroud)
那么返回值当然是空的。我的互联网搜索没有产生任何有用的结果。有人可以帮我找到原因并解决问题吗?谢谢你!