我刚刚升级到Dart 2和最新版本的Flutter,现在我无法构建我的应用程序.我在互联网上环顾四周,但仍然不明白为什么会这样.
我得到的错误是:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:preDebugBuild'.
> Android dependency 'com.android.support:support-v4' has different version for the compile (26.1.0) and runtime (27.1.0) classpath. You should manually set the same version via DependencyResolution
Run Code Online (Sandbox Code Playgroud)
项目build.grade:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.2.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task …Run Code Online (Sandbox Code Playgroud) 我正在使用以下代码段绘制一些实时时间序列折线图:
new SizedBox(
height: MediaQuery.of(context).size.height / 4,
child: new charts.TimeSeriesChart([
new charts.Series<HistoryData, DateTime>(
id: 'test',
colorFn: (_, __) => colourArray[dataArrayName],
data: dataArray,
domainFn: (HistoryData sales, _) => sales.date,
measureFn: (HistoryData sales, _) => sales.historyValue)
],
animate: true,
dateTimeFactory: const charts.LocalDateTimeFactory()),
)
class HistoryData {
final DateTime date;
final double historyValue;
HistoryData(this.date, this.historyValue);
}
Run Code Online (Sandbox Code Playgroud)
数据显示正常,但我注意到只有一个 x 轴标签:
我想知道是否有人可以帮助我弄清楚如何制作它,以便在 x 轴上有许多均匀分布的刻度。
谢谢
编辑:dataArray是一个类型的变量List<HistoryData>
这是印刷品:
I/flutter (19864): [Instance of 'HistoryData', Instance of 'HistoryData', Instance of 'HistoryData', Instance of 'HistoryData', Instance …
我有两个这样的循环:
for x = 1:1:15
for y = 1:1:15
values(x,y) = x^2 + y
end
end
Run Code Online (Sandbox Code Playgroud)
这允许我为x和y的每个组合计算x ^ 2 + y(如果它们是整数).
但是,如果我想计算小数的x ^ 2 + y怎么办?
所以像这样:
for x = 0:0.1:15
for y = 0:0.1:15
????? = x^2 + y
end
end
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮我找到一个方法,可以计算x ^ 2 + y的所有可能性,如果x和y是小数,那么不能再用作索引了吗?
我想实现一个 WebFilter,它读取传入请求的特定标头,使用此标头的值将 GET 请求调用到另一个反应式 REST 端点,然后使用 GET 响应的值改变原始请求。
我想在 WebFilter 中实现它,因为我不想将此函数调用添加到我的@RestController.
目前我有这个:
@Component
class ExampleWebFilter(val webClients: WebClients) : WebFilter {
override fun filter(exchange: ServerWebExchange, chain: WebFilterChain): Mono<Void> {
println(exchange.request.headers)
println(exchange.request.path)
println(exchange.response)
val test = webClients.internalAuthServiceClient.get()
.uri("/api/authorisation/v1/test")
.header("authToken", "authToken123")
.retrieve().bodyToMono(String::class.java)
println(test)
exchange.mutate().request(
exchange.request.mutate().header("newheader", test).build()
)
return chain.filter(exchange)
}
}
@Component
class WebClients() {
val internalAuthServiceClient = WebClient.builder()
.baseUrl("lb://auth-service")
.build()
}
Run Code Online (Sandbox Code Playgroud)
这显然现在行不通。我的 WebClient 正在返回 Mono,所以我不能直接在我的mutate()调用中使用它,因为这需要一个字符串。由于显而易见的原因,我也无法真正让 WebClient 调用阻塞操作。
有谁知道我如何解决这个问题?