我使用 svgPicture 显示图像,每次首先显示错误,然后显示图像。
SvgPicture.asset(
'assets/Images/otpLogo.svg',
height: SizeConfig.blockSizeVertical * 26,
),
Run Code Online (Sandbox Code Playgroud)
错误是
???SVG 捕获的异常 ?????????????????????????????????????????????? ?????????????????????????????? I/flutter (18256): _getDefinitionPaint 中抛出以下断言: I/flutter (18256): Failed to find definition for url(#paint0_linear)
I/flutter (18256): 这个库只支持和 xlink:href 引用是在他们的 I/flutter (18256) 之前定义:参考。I/flutter (18256):当所需的定义在引用它的元素之后定义 I/flutter (18256):(例如在文件末尾)或在另一个文件中定义时,可能会导致此错误。I/flutter (18256):此错误被视为非致命错误,但您的 SVG 文件可能无法按预期呈现
我使用permission_handle 获取位置许可。
它总是说“在清单中找不到权限”,即使我试过了 "flutter clean"
import 'package:permission_handler/permission_handler.dart';
class PermissionsService {
final PermissionHandler _permissionHandler = PermissionHandler();
Future<bool> _requestPermission(PermissionGroup permission) async {
var result = await _permissionHandler.requestPermissions([permission]);
if (result[permission] == PermissionStatus.granted) {
print('innnn');
return true;
}
return false;
}
Future<bool> requestLocationPermission({Function onPermissionDenied} ) async {
// return _requestPermission(PermissionGroup.locationWhenInUse);
var granted = await _requestPermission(PermissionGroup.location );
if(!granted){
onPermissionDenied();
}
return granted;
}
}
Run Code Online (Sandbox Code Playgroud)
我的 Manifest.xml 文件
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.artistry">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to …Run Code Online (Sandbox Code Playgroud)