Questions tagged [dartz]

functional programming library in dart

41 questions
0
votes
2 answers

type 'String' is not a subtype of type 'Exception' in type cast

I am using dartz package to return different types from a method, but the problem is I can't return an exception. here is the code below: class CatPhotoApi { String endpoint = 'api.thecatapi.com'; Future
Hama Sabah
  • 342
  • 4
  • 9
0
votes
2 answers

Why separating emit() to void function made Bloc working?

I had weird problem on which I spend few hours. I have a bloc file in which I'm using dartZ to easier maintain errors. When I was using bloc like this: NumberTriviaBloc({required this.getConcreteNumberTrivia}) : super(Empty()) { …
Dawid Twin
  • 27
  • 7
0
votes
1 answer

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 Some(EitherValue) the output is: Some(Right("hi")) How to get the value of hi without "Some(Right" ?
user16906111
0
votes
1 answer

How to "concatenate" Lefts using Dartz

I want to do something similar to a Either.map5 on several Either types. But, instead of keeping just the first Left in case of my Eithers being Left, I want to keep all the Left Either contents, and put them into a List. Basically instead of the…
LeYAUable
  • 1,613
  • 2
  • 15
  • 30
0
votes
1 answer

How to use the fold method for a future type?

I have this method as my repository: Future> userRegister(FormData formData) async { try { final response = await _mourdakApi.userRegister(formData); bool _isSuccesed; if (response.statusCode == 200) …
amin jamali
  • 360
  • 1
  • 3
  • 16
0
votes
1 answer

'Null' can't be assigned to the parameter type 'AccountType Function()'

Is possible that some can explain to me what's going on here. I completely new to flutter and dart programming and I have started a video tutorial on youtube which are using DDD architecture, but I guess the tutorial does not use the new version of…
user3693057
0
votes
1 answer

Dartz interface invalid override

I am currently setting up a phone number verification in flutter with the dartz package. My firebase_auth_facade.dart inherits from my i_auth_facade.dart but when I try to set up the phonenumber verification functions I get the…
Andi
  • 25
  • 1
  • 5
0
votes
2 answers

Compiler Error when using Either from dartz

I am currently experimenting with the flutter framework and dart and stumbled across a seemingly strange behaviour I fail to understand. Even though the context in which the actual problem occurs is way more complicated, I was even able to replicate…
Silverdust
  • 1,503
  • 14
  • 26
0
votes
1 answer

Return an Either object from a different Either in Dartz

I have a function in Dart where I would like to return an Either value to propagate a Failure(left) or an Object(right). These data are dependent on a different Either value in a function likes this in Dart, but currently it is returning null, even…
sempernoob
  • 186
  • 2
  • 8
-1
votes
2 answers

Flutter : isolate the right hand of Future

iam using riverpod with dartz , nad iam facing a problem that when using a future provider with my function i can't get my hand on the either as well , how can i isolate what i want to retrieve from the function with error handling ! my provider…
Fahmi Sawalha
  • 682
  • 6
  • 19
-1
votes
1 answer

Flutter app: Can't return value of type "Either" from method because it has a return type of "Either"

Can't figure this one out - especially as the type-error in VSCode and Android Studio is telling me that the types are identical. Error: "A value of type 'Either (where Failure is defined in ...lib\core\error\failures.dart)'…
1 2
3