问题标签 [dartz]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
27 浏览

flutter - 我什么时候应该让应用程序崩溃?

我有两个问题:

首先

我什么时候应该让应用程序崩溃?

第二:

此代码来自 resoCoder。我不明白!!!!!!!!!!!!todos如果不正确,他怎么能让应用程序崩溃?!

0 投票
0 回答
112 浏览

flutter - 使用 DartZ 调用多个 Future 时如何避免嵌套折叠?

我有一段看起来像这样的代码:

基本上,我想调用第一个函数,它返回一个失败或一个单元(成功值无关紧要)。

然后,如果第一个函数成功,我想调用另一个函数,它也返回 Future 或 Unit。

我该怎么做才能避免这种丑陋的嵌套调用foldinside another fold

我正在使用包dartz,这真的很酷,但缺乏文档。

0 投票
1 回答
216 浏览

flutter - flutter -bloc - how to resolve Failed Assertion : !_isComplete

I am stuck at this exception .

I am trying to create a Number Trivia app based on course on you tube

basically i'm handling errors and exceptions with Either class from dartz library;

so basically the string number comes from event and get passed to a static method from class InputConversion which return an Either<Failure,int> . i execute a fold on the returned value emitting Error state in the case of Left aka Failure and for Right i get the NumberTrivia from api using returned int . api also returns an Either which i fold on again but it throws the following exception

0 投票
0 回答
33 浏览

flutter - 'Iterable 类型的值>'不能从函数'failureOption'返回

我正在使用冻结,但我无法折叠项目列表的值。我正在创建一个包含复选框的 NoteContent 和整数值的类,它将显示在列表视图中。

注意代码是:

错误是:

无法从函数“failureOption”返回“Iterable<NoteValueFailures>”类型的值,因为它的返回类型为“Option<NoteValueFailures>”。 注意内容代码是:

0 投票
0 回答
23 浏览

flutter - dartz中的dflt是什么意思?

dflt是什么意思?来自达茨图书馆。

代码是:

0 投票
1 回答
76 浏览

flutter - 如何使用 Dartz“连接”Left

我想在几种 Either 类型上做类似于 Either.map5 的事情。但是,我不想只保留第一个 Left 以防我的 Eithers 被留下,而是要保留所有 Left Either 内容,并将它们放入一个列表中。

基本上,我想要一个 Either<List,R>,而不是 map5 的 Either<L,R> 结果。

有没有一种开箱即用的方式来做到这一点 dartz ?

0 投票
1 回答
26 浏览

flutter - How to obtain only the right hand side value from dartz?

How to obtain only the right hand side value from dartz?

the code is

the output is:

How to get the value of hi without "Some(Right" ?

0 投票
0 回答
61 浏览

flutter - 颤振测试,存根使用 dartz 的方法失败

这是我正在测试的肘部的牵连方法:

我正在测试未经身份验证的部分authCheck,这是测试:

但是当存根authCubit.signInAnonymously返回 aFuture<void>我得到这个错误:

0 投票
1 回答
82 浏览

flutter - Flutter bloc 8 异步/折叠返回中的一些错误

我正在将我的项目迁移到新版本的 Flutter 并使用 BloC 包。如您所知,Bloc 已经更新并且它已经更改了大部分代码,所以现在我正在调整我的,但我有一些错误。

参数类型“Future Function(bool)”不能分配给参数类型“UserState Function(bool)”

主体可能正常完成,导致返回“null”,但返回类型可能是不可为空的类型。

前 :

后 :

我需要在里面有那个异步,因为我再次调用了服务,关于身体,在我看来我必须以某种方式返回它,但我里面有一些逻辑,我不知道该怎么做。

0 投票
2 回答
35 浏览

flutter - 为什么将 emit() 与 void 函数分开会使 Bloc 工作?

我有一个奇怪的问题,我花了几个小时。我有一个 bloc 文件,我在其中使用 dartZ 来更轻松地维护错误。当我像这样使用 bloc 时:

我收到错误消息,说我没有等待一些 Future - https://pastebin.com/FWTFKYVH但这似乎不是真的,因为我只有一个 getConcreteNumberTrivia返回 Future 的函数,它正在等待中。

但是当我被切断最后一次发射以分离这样的功能时:

代码开始正常工作。我不明白,我只是将代码移动到 void 函数,它没有做任何额外的事情,有人可以解释我为什么吗?