Skip to content

feat: generics support for dart #1114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Conversation

ChiragAgg5k
Copy link
Member

@ChiragAgg5k ChiragAgg5k commented Jul 21, 2025

What does this PR do?

add generics support to dart lang

Test Plan

Related PRs and Issues

Have you read the Contributing Guidelines on issues?

yes.

@ChiragAgg5k ChiragAgg5k requested a review from Copilot July 21, 2025 11:24
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements generics support for the Dart SDK generation, specifically adding type parameter support for models with dynamic data properties and their associated services. The changes enable better type safety when working with documents and collections that can contain custom data structures.

Key changes include:

  • Enhanced model classes to support generic type parameters for dynamic data properties
  • Updated service methods to accept type conversion functions for generic models
  • Modified template logic to handle underscore-prefixed properties with appropriate getters

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
templates/dart/lib/src/models/model.dart.twig Adds generic type support to model classes with conditional type parameters and property handling
templates/dart/test/src/models/model_test.dart.twig Updates test generation to handle underscore-prefixed properties in generic models
templates/dart/lib/services/service.dart.twig Modifies service methods to support generic return types and type conversion functions
templates/dart/base/requests/api.twig Updates API response handling to pass type conversion functions to generic models
src/SDK/Language/Dart.php Implements helper methods for detecting generic types and generating property types
src/SDK/Language/Kotlin.php Fixes return type annotation from string to bool for consistency
example.php Updates to use separate specifications for different platform targets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant