Giter Site home page Giter Site logo

helightdev / dogs Goto Github PK

View Code? Open in Web Editor NEW
10.0 1.0 0.0 3.02 MB

an object mapping and serialization library that uses code generation to create a structure definition of your serializable classes, which is usable at runtime.

Home Page: https://dogs.helight.dev

License: Apache License 2.0

Dart 98.28% Shell 0.96% HTML 0.76%
dart serialization generator dataclass json odm object-mapper

dogs's Introduction

Age CQ Linkedin: Christoph Feuerer Instagram: Christoph Feuerer

Hello there! ๐Ÿ‘‹

I'm Christoph, a Fullstack Developer from Germany.

๐Ÿ“Š Developer Stats

๐Ÿ† Profile Trophies

Trophies

dogs's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

dogs's Issues

"dogs" constructors don't seem to work when the dogs constructor is on a base class

Affected packages

  • dogs_core
  • dogs_generator

Describe the bug
When using a base class that has an initializer list, the generation of serializers for an inheriting class fails with this error:

Exception: Serializable constructors must only reference instance fields: #0      structurizeConstructor (package:dogs_generator/analyze/structurize.dart:125:7)
#1      ConverterBuilder.generateForClass (package:dogs_generator/builders/converter_builder.dart:82:28)
#2      ConverterBuilder.generateSubject (package:dogs_generator/builders/converter_builder.dart:355:17)
#3      _ServiceAdapterServiceBuilder.build (package:lyell_gen/src/subject.dart:127:19)
<asynchronous suspension>
#4      runBuilder.buildForInput (package:build/src/generate/run_builder.dart:83:7)
<asynchronous suspension>
#5      Future.wait.<anonymous closure> (dart:async/future.dart:523:21)
<asynchronous suspension>
#6      scopeLogAsync.<anonymous closure> (package:build/src/builder/logging.dart:32:40)
<asynchronous suspension>

To Reproduce
Steps to reproduce the behavior:

  1. Create a Dart project with these classes:
import 'package:uuid/uuid.dart';
import 'package:dogs_core/dogs_core.dart';

abstract class Base {
  final String id;

  Base({String? id}) : id = id ?? const Uuid().v4();

  Base.dogs(this.id);
}

@serializable
class User extends Base with Dataclass<User> {
  final String username;

  User({
    super.id,
    required this.username,
  });
}
  1. Run the build_runner
  2. Observe the error

Expected behavior
There ought to be a way to handle this case, though I don't know exactly what the best way is.

Upgrade analyzer dependency to 6.4.0 to support Dart >3.2.0

Affected packages

  • dogs_generator

Describe the bug
When I run the generator, I get this warning:

Your current `analyzer` version may not fully support your current SDK version.

Analyzer language version: 3.1.0
SDK language version: 3.2.0

Please update to the latest `analyzer` version (6.4.0) by running
`flutter packages upgrade`.

If you are not getting the latest version by running the above command, you
can try adding a constraint like the following to your pubspec to start
diagnosing why you can't get the latest version:

dev_dependencies:
  analyzer: ^6.4.0

To Reproduce
Steps to reproduce the behavior:

  1. Use the dart 3.2.0 sdk or higher to create a project
  2. Add dogs_core and dogs_generator
  3. Create a serializable class
  4. Run the build runner

Expected behavior
dogs should support the latest sdk

Additional context
Dart SDK version: 3.2.5 (stable) (Tue Jan 16 15:02:13 2024 +0000) on "macos_arm64"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.