Questions tagged [flutter-freezed]

95 questions
0
votes
1 answer

When I use Flutter Freezed, can I parse more than one jsonData in the same layer into a model?

Here's one jsonData. { 'name' :'chris', 'age' : 52, 'gender' : M, 'hobby' :'piano', 'favoriteFood' :'burger' } Here are two Freezed models @freezed class DefaultModel with _$DefaultModel{ const factory DefaultModel({ required String name, …
seokseok
  • 21
  • 2
0
votes
1 answer

Freezed: Could not resolve annotation for `int get hashCode`: @JSONKey(ignore: true)

When I try to generate freezed files on this classes, it gives me this error. I tried to rewrite hashCode getter on MappedLesson class but it didn't change anything. line 1, column 4214 of package:derstakip_2/models/lat_models.freezed.dart: Could…
Ataberk
  • 557
  • 1
  • 6
  • 26
0
votes
1 answer

BLoC state + freezed library with multiple fields

I created bloc with "on" handler where I request topics from API. I can control loading and error. I add the second "on" handler in bloc where I request top selected topic, and I want to work with the same bloc with topics to save this top selected…
0
votes
1 answer

Freezed - cannot find my type after file rename

I just renamed a bunch of files and now I can't start my app as it has all these run-time errors to the effect of: VpUser? createdBy, ^^^^^^ : Error: 'VpUser' isn't a type. Then I go to my code where the error is supposed to be and the…
BeniaminoBaggins
  • 11,202
  • 41
  • 152
  • 287
0
votes
0 answers

Flutter Cubit State Design for Navigation

Good day everyone! Let's imagine I am using Flutter Cubit with @freezed for an authentication screen. There are several ways on how to structure the state but all come with a problem I can't find a way around. I normally design my States like…
0
votes
2 answers

Could not generate 'fromJson' code for custom model using freezed build

I made a class using freezed in flutter like this. import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:flutter/foundation.dart'; import 'package:my_project/src/models/post.dart'; part 'post_state.freezed.dart'; part…
Ian Cho
  • 89
  • 6
0
votes
1 answer

How to generate a datetime in model using flutter freezed package

I have this freezed part import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; part 'user_model.freezed.dart'; part 'user_model.g.dart'; @freezed class UserModel with _$UserModel { …
Tpp
  • 159
  • 7
0
votes
1 answer

Use Freezed union types with some implemented fields

I'm trying to use Freezed "Mixins and Interfaces for individual classes for union types" by following the documentation, but I'm struggling with one thing. The doc examples are pretty simples and the interfaces do not define any fields. However in…
Pom12
  • 7,622
  • 5
  • 50
  • 69
0
votes
1 answer

freezed package can not generate toJson code for nested object anymore

We've discovered an issue in our monorepo that prevents us from generating .g.dart files for our models. Most of the models are deeply nested and need fromJson/toJson methods to communicate with our backend. Three weeks ago we updated freezed and…
0
votes
1 answer

Flutter ignore field using Freezed

I'm using Freezed to generate my models. I want to ignore a specific key, so I'm using @JsonKey(ignore: true). @freezed class ObjectA with _$ObjectA { const factory ObjectA({ @JsonKey(ignore: true) List ObjectBList, }) =…
genericUser
  • 4,417
  • 1
  • 28
  • 73
0
votes
1 answer

How do i use Flutter Freezed package?

How do I use the freezed 2.2 package in my flutter app?
daniel
  • 1
0
votes
0 answers

type '_InternalLinkedHashMap' is not a subtype of type 'List' in type cast - error while parsing JSON in flutter

I'm building an movie app using the TMDB API as my backend. Without the List cast everything works perfect. But when I'm adding that I'm getting the following error. type '_InternalLinkedHashMap' is not a subtype of type…
0
votes
1 answer

Freezed class with generic type and fromJson, toJson

I'm trying to make a Freezed class with a generic type that has toJson and fromJson: import 'package:freezed_annotation/freezed_annotation.dart'; part 'option.freezed.dart'; part 'option.g.dart'; @Freezed(genericArgumentFactories: true) class…
BeniaminoBaggins
  • 11,202
  • 41
  • 152
  • 287
0
votes
2 answers

Android Studio doesn't see BlocProvider

Android Studio doesn't see BlocProvider When I try to add BlocProvider to HomePage, Android Studio doesn't see it and of cource i can't use it. in the project i use freezed_annotation: ^2.1.0 main.dart import…
Timson01
  • 35
  • 5
0
votes
1 answer

Flutter generate Freezed files for Cubit with build_runner not working

I am trying to use the Freezed Package together with the Cubits from the Bloc Package. I followed this tutorial and I want to simply create Cubits with Freezed but I can not make it work. Calling: flutter pub run build_runner build…
Chris
  • 1,828
  • 6
  • 40
  • 108