如下使用类 Bloc 提供程序时,出现错误:
'未为类型'BuildContext'定义方法'ancestorInheritedElementForWidgetOfExactType'。
所以我替换了这条线 context.ancestorInheritedElementForWidgetOfExactType(type)?.widget;
用这条线 context.getElementForInheritedWidgetOfExactType<_BlocProviderInherited<T>>().widget;
但后来我收到以下错误:
Error output from Xcode build:
?
** BUILD FAILED **
Xcode's output:
?
../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/dynamic_theme-1.0.1/lib/dynamic_theme.dart:25:20: Error: The method 'ancestorStateOfType' isn't defined for the class 'BuildContext'.
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('../../../development/flutter/packages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'ancestorStateOfType'.
return context.ancestorStateOfType(const TypeMatcher<DynamicThemeState>());
^^^^^^^^^^^^^^^^^^^
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning …Run Code Online (Sandbox Code Playgroud) 我有一个 Spring Boot 应用程序,并使用在 brew 服务中运行的 mongo db 开发它。
要连接到数据库,我只需将以下内容放入 Spring Boot 中的 application.properties 中
spring.data.mongodb.uri=mongodb://localhost:27017/db
Run Code Online (Sandbox Code Playgroud)
将应用程序属性更改为
spring.data.mongodb.uri=mongodb://mongo:27017/db
Run Code Online (Sandbox Code Playgroud)
没有改变任何东西,和以前一样的错误。
现在我正在尝试将 SpringBoot 应用程序和 MongoDB 放入 Docker-Containers 中,但无法使任何连接正常工作。
所以这是我在 SpringBoot 应用程序中的 Dockerfile:
FROM openjdk:8-jdk-alpine
VOLUME /tmp
EXPOSE 8080
ADD /build/libs/dg-0.0.1-SNAPSHOT.jar dg-0.0.1-SNAPSHOT.jar
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/dg-0.0.1-SNAPSHOT.jar"]
Run Code Online (Sandbox Code Playgroud)
这是我的 Docker-Compose.yml 文件:
version: '3'
services:
mongo:
container_name: docker-mongo
image: mongo:latest
ports:
- "27017:27017"
volumes:
- ./data/db:/data/db
spring:
depends_on:
- mongo
image:
docker-spring-http-alpine
ports:
- "8080:8080"
links:
- mongo
Run Code Online (Sandbox Code Playgroud)
执行 Docker-Compose 后
docker-compose up
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:(这是实际的错误消息)
2019-07-08 23:10:19.990 INFO 1 …Run Code Online (Sandbox Code Playgroud) 我需要一个用于共享首选项的单例,它具有异步初始化,但也适用于空安全。通常我使用以下单例实现,但是拥有空安全性的单例的最佳方法是什么?
class SharedPrefs {
static SharedPrefs _instance;
static Future<Null> _mutex;
static Future<SharedPrefs> getInstance() async {
if (_mutex != null) {
await _mutex;
}
var completer = Completer<Null>();
_mutex = completer.future;
if (_instance == null) {
_instance = SharedPrefs();
await _instance.init();
}
completer.complete();
_mutex = null;
return _instance;
}
SharedPreferences prefs;
SharedPrefs();
Future<SharedPrefs> init() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
return this;
}
dynamic get(String key) {
return prefs.getString(key);
}
Future<bool> put(String key, dynamic value) async {
return await prefs.setString(key,value); …Run Code Online (Sandbox Code Playgroud) 我正在使用 OxyPlot 来绘制特定时间范围内的数量。
我使用的 3 个不同时间范围的可能性是:
一天,两天到31天,1年到4年。
某一天,情节总是必须显示 0 到 24 小时。
对于两天到 31 天,我想设置例如第一天,比如 1 月 1 日,然后在下一个 1 月 15 日和最后一个 1 月 30 日。
对于一年到 4 年的时间,我想设置 4 个刻度,例如 2011 2012 2013 2014。
这是否可以通过设置开始和结束时间以及间隔和字符串格式以某种方式实现?
可以设置开始时间和结束时间吗?
是否可以像 ReorderableListView 一样对 ListView 的顺序更改进行动画处理,但无需用户交互。
例如,意味着几秒钟后 ListView 的顺序会发生变化。所以我有两个包含相同项目但顺序不同的列表。列表一和列表二。
我已经看到了 AnimatedList,但在那里我可以删除或添加动画。我需要像移动动画这样的东西。
有点像 ReorderableListView,但没有用户交互。或者是否可以在 ReorderableListView 中以编程方式替换用户交互?
提前致谢
我有一个 Java FX 项目,并使用以下 Azul Zulu Build of OpenJDK with JavaFX 将项目升级到 JDK 17
https://www.azul.com/downloads/?os=windows&package=jdk-fx
有谁知道为什么 Intellij 无法从 Azul Zulu Builds of OpenJDK with FX 中找到使用 JDK 17 的 JavaFX 包吗?
注销的正确方法是什么?
这些是 keycloak 客户端设置:
Realm: REALM
Client ID: pkce-client
Client Protocol: openid-connect
Access Type: public
Standard Flow Enabled: ON
Valid Redirect URIs: http://localhost:4200/
Backchannel Logou: ON
Run Code Online (Sandbox Code Playgroud)
OpenID Connect 兼容模式
Use Refresh Tokens: ON
Run Code Online (Sandbox Code Playgroud)
高级设置:
Proof Key for Code Exchange Code Challenge Method: S256
Run Code Online (Sandbox Code Playgroud)
有没有好的文档?
我的想法是删除客户端的令牌,但随后会话在 keycloak 中仍然处于活动状态。
解决方案是调用以下 URL:
http://localhost:8180/auth/realms/REALM/protocol/openid-connect/logout?id_token_hint=InR5cCIgOiAiSldUIiwia2lkIiA6ICIxUVJwMXAtbmk1WmcyZmlyRHFoRS1iS1hwemZDaWFocGs4Zi1XRkQtRDZ3In0.eyJleHAiOjE2NDE3NjUyNjYsImlhdCI6MTY0MTc2.......
Run Code Online (Sandbox Code Playgroud) 我试图将轴旁边的值的格式从例如1000更改为1k或1000000到1M.
这在LinearAxis中是否可行?
这是我的代码:
m.Axes.Add(new LinearAxis
{
Position = AxisPosition.Right,
IsZoomEnabled = false,
IsPanEnabled = false,
Minimum = -(_maxPointValue2*0.1),
Maximum = _maxPointValue2 + (_maxPointValue2*0.1),
FontSize = 15,
Key = "right",
TickStyle = TickStyle.Outside,
});
Run Code Online (Sandbox Code Playgroud)
这可能与StringFormat一起使用吗?
也可以更改TickStyle,以便破折号通过整个情节?
提前致谢
迈克尔