Skip to content
This repository was archived by the owner on May 24, 2023. It is now read-only.
This repository was archived by the owner on May 24, 2023. It is now read-only.

latest update graphs 2.3.0 ruined common annotations json & hive in build_runner #86

@forsytalnd

Description

@forsytalnd

I dunno if this is your issue, but...
Your library is in dependencies in build_runner and after last updating 2.2.0 --> 2.3.0 an issue was happened.

When there are both annotations in class, like that,

part 'user.freezed.dart';
part 'user.g.dart';

/// Класс пользователя для авторизации
@freezed
class AuthUser with _$AuthUser {
  /// Базовый класс typeId: 0, adapterName: 'AuthUserAdapter'
  @HiveType(typeId: 0)
  const factory AuthUser({
    @HiveField(0) required String id,
  }) = _AuthUser;

  /// AuthUser.fromJson
  factory AuthUser.fromJson(Map<String, dynamic> json) =>
      _$AuthUserFromJson(json);

json_annotation which is indirectly called from freezed had been adding its annotations in ".g.dart" alongside with hive

part of 'user.dart';

// **************************************************************************
// TypeAdapterGenerator
// **************************************************************************

class AuthUserAdapter extends TypeAdapter<_$_AuthUser> {
  @override
  final int typeId = 0;


// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************

_$_AuthUser _$$_AuthUserFromJson(Map<String, dynamic> json) => $checkedCreate(
      r'_$_AuthUser',
      json,
      ($checkedConvert) {
        final val = _$_AuthUser(

As a result of last night updating of graphs json generator overrides file .g.dart and previous info disappears.

I added this issue to build_runner repository too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions