我正在寻找有关我的项目库的一些 NuGet 更新。我看到有很多 Microsoft 库更新到 v5.0.0。
根据我的知识,我认为这些是 .Net 5.0 发布的新依赖项,我不确定是否可以使用 .Net Core 3.1 项目将这些库更新到最新版本。
即使我正在使用/构建 .Net Core 3.1 项目,我也可以更新到 v5.0.0 库吗?
从 .NET 5.0 升级到 .NET 6.0(包括作为实体框架的所有相关 Microsoft 库)后,我在使用 EF Core 对数据库上下文执行查询时开始收到此错误:
System.InvalidOperationException:警告“Microsoft.EntityFrameworkCore.Query.NavigationBaseIncludeIgnored”生成错误:导航“MarkersTranslation.Marker”在查询中被忽略,因为修复将自动填充它。如果之后在“包含”中指定了任何进一步的导航,那么它们将被忽略。不允许步行返回,包括树木。通过将事件 ID“CoreEventId.NavigationBaseIncludeIgnored”传递给“DbContext.OnConfiguring”或“AddDbContext”中的“ConfigureWarnings”方法,可以抑制或记录此异常。
这是有罪的代码:
Tour tour = await _context.Tours.Include(mpt => mpt.MarkersPerTours)
.ThenInclude(mrk => mrk.Marker)
.ThenInclude(mrkProp => mrkProp.MarkersTranslations)
.ThenInclude(mrk => mrk.Marker)
.ThenInclude(mrkTp => mrkTp.Type)
.FirstOrDefaultAsync(t => t.Id == tourId);
Run Code Online (Sandbox Code Playgroud)
因此,每个实体都有一组与其翻译Tour相关的集合,但每个实体也都有一个.MarkerMarkerType
Microsoft Docs似乎批准了我用于此查询的模式,以便包含多个级别。
现在使用 EF Core 6 获得相同结果的正确方法是什么?
我正在尝试在我的应用程序中实现闪屏页面。我需要在显示页面时自动启动动画,但实际实现不起作用。动画不会在页面打开时执行。
import 'package:flutter/material.dart';
import 'package:coin_flip_app/home_page.dart';
import 'package:flutter_svg/flutter_svg.dart';
class SplashScreenPage extends StatefulWidget {
SplashScreenPage({Key key}) : super(key: key);
@override
_SplashScreenPageState createState() => _SplashScreenPageState();
}
class _SplashScreenPageState extends State<SplashScreenPage>
with SingleTickerProviderStateMixin {
AnimationController _controller;
@override
void initState() {
super.initState();
_controller = AnimationController(
vsync: this, duration: Duration(milliseconds: 250), value: 1);
Future.delayed(Duration(seconds: 4), () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => HomePage(),
));
});
_controller.forward().then((f) {
_controller.reverse();
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
color: const Color.fromARGB(255, 48, 48, 48), …Run Code Online (Sandbox Code Playgroud) 当我的提供者在http.get()调用过程中出现问题时,我试图将快照错误状态返回给我的 StreamBuilder 。在我的情况下,当http.get()返回一个不同于 200 (OK) 的状态时,我抛出一个异常。我希望能够将错误状态返回给快照并针对这种情况执行特定代码。现在,当我抛出异常时,应用程序就会崩溃。
供应商:
class FmsApiProvider {
Future<List<FmsListResponse>> fetchFmsList() async {
print("Starting fetch FMS..");
final Response response = await httpGet('fms');
if (response.statusCode == HttpStatus.ok) {
// If the call to the server was successful, parse the JSON
return fmsListResponseFromJson(response.body);
} else {
// If that call was not successful, throw an error.
//return Future.error(List<FmsListResponse>());
throw Exception('Failed to load FMSs');
}
}
}
Run Code Online (Sandbox Code Playgroud)
存储库:
class Repository {
final fmsApiProvider = FmsApiProvider();
Future<List<FmsListResponse>> fetchAllFms() => …Run Code Online (Sandbox Code Playgroud) 我已经更新了我的 flutter 应用程序包,包括从到 的url_launcher包。6.0.206.1.2
更新后,许多 Android 用户 (API 30/31/32) 报告称,由于出现错误,他们无法使用 Google 地图应用启动导航至指定点(纬度和经度):
\nWebpage not available. \n\nWebpage not available\nThe webpage at intent://maps.app.goo.gl/?\nlink=https://www.google.com/maps/dir//45.8597077,.........\ncould not be loaded because:\nnet: ERR_UNKNOWN_URL_SCHEME\nRun Code Online (Sandbox Code Playgroud)\n这是我的工作代码6.0.20
Webpage not available. \n\nWebpage not available\nThe webpage at intent://maps.app.goo.gl/?\nlink=https://www.google.com/maps/dir//45.8597077,.........\ncould not be loaded because:\nnet: ERR_UNKNOWN_URL_SCHEME\nRun Code Online (Sandbox Code Playgroud)\n这是不工作的6.1.2
final String gMapsUrl = \'https://www.google.com/maps/dir/api=1&destination=$latitude,$longitude&travelmode=driving\';\n\nif (Platform.isAndroid && await canLaunch(gMapsUrl)) {\n await launch(gMapsUrl);\n}\nRun Code Online (Sandbox Code Playgroud)\n现在启动 Google 地图 url 以便启动应用内或网络浏览器导航而不强制用户使用应用内或网络导航的正确方法是什么?
\n[\xe2\x9c\x93] Flutter (Channel stable, 2.10.3, on macOS …Run Code Online (Sandbox Code Playgroud) 我正在尝试将Drawer中的UserAccountsDrawerHeader背景从浅蓝色更改为另一种颜色,但是找不到解决方案。谁能帮我?
return Drawer(
child: ListView(
// Important: Remove any padding from the ListView.
padding: EdgeInsets.zero,
children: <Widget>[
UserAccountsDrawerHeader(
accountName: Text(sessionUsername),
accountEmail: Text(mail),
currentAccountPicture: CircleAvatar(
backgroundColor: Colors.red,
backgroundImage: NetworkImage(gravatarUrl),
),
),
ListTile(
title: Text('Home'),
leading: Icon(Icons.home, color: myColor),
onTap: () {
print("Going to home");
//Close the drawer
Navigator.of(context).pop();
//Navigate to home page
//Navigate with avoiding the possibility to return
Navigator.of(context).pushReplacementNamed(HomePage.tag);
},
),
],
),
);
Run Code Online (Sandbox Code Playgroud)
MyDrawer:
我需要找到一种方法来强制 FlutterText小部件使用两个文本行空间,即使该行只有一个。例如,在下面的照片中,由于Text小部件仅使用一个行距,因此一张卡片低于另一张卡片。
有谁知道即使只需要一行也能强制Text小部件使用maxLines空间的技巧?