Skip to content

feat: Add complete Dart support with typed features (beta)#35

Merged
JoshuaWink merged 4 commits intomainfrom
copilot/add-dart-support
Oct 16, 2025
Merged

feat: Add complete Dart support with typed features (beta)#35
JoshuaWink merged 4 commits intomainfrom
copilot/add-dart-support

Conversation

Copy link
Contributor

Copilot AI commented Oct 15, 2025

This PR implements comprehensive Dart support for the CodeUChain framework, bringing the universal composable software patterns to Dart developers with full typed features support.

🎯 Overview

CodeUChain now supports Dart with a feature-complete beta implementation that follows the same mental model as all other language implementations while leveraging Dart's unique strengths including null safety, strong typing, and async/await patterns.

✨ Key Features Implemented

Core Components

  • Context: Immutable data container with generic typing support and optional mutable version for performance
  • Link<TInput, TOutput>: Generic interface for processing units with async execution patterns
  • Chain<TInput, TOutput>: Orchestrator for link composition with middleware support
  • Middleware System: Rich observability with built-in logging, performance monitoring, and error handling

Typed Features

  • Generic Types: Link<TInput, TOutput> and Context<T> for compile-time safety
  • Type Evolution: Clean transformations via insertAs<U>() method without explicit casting
  • Zero Performance Impact: Identical runtime behavior with or without typing
  • Gradual Adoption: Add typing incrementally to existing code

Dart-Specific Enhancements

  • Leverages Dart's null safety for robust error handling
  • Supports both synchronous and asynchronous operations
  • Immutable-by-default with performance escape hatches
  • Rich middleware ecosystem with function-based middleware support

🧪 Beta Status

The Dart implementation is feature-complete and thoroughly tested but marked as beta to allow for potential API refinements based on real-world usage and performance optimization feedback. The core concepts and patterns are stable and follow CodeUChain's universal design principles.

Beta Changes Made

  • Version: Set to 1.0.0-beta.1 in pubspec.yaml
  • Documentation: Added beta notices in README files explaining the status
  • Installation: Updated instructions to use beta version
  • Status: Clearly marked as beta in both main and package README

🧪 Quality Assurance

  • 21 comprehensive tests covering all features and edge cases
  • Zero analyzer issues - clean, production-ready code
  • Working examples demonstrating 5 different usage scenarios
  • Complete documentation with API reference and migration guides
  • CodeQL security scan passed with no vulnerabilities

📦 Package Structure

import 'package:codeuchain/codeuchain.dart';

// Define a processing link
class ProcessUserLink extends BaseLink<UserInput, ProcessedUser> {
  ProcessUserLink() : super('ProcessUser');

  @override
  Future<Context<ProcessedUser>> execute(Context<UserInput> context) async {
    final user = context.get('userData') as UserInput;
    final processed = await processUser(user);
    return context.insertAs<ProcessedUser>('processedUser', processed);
  }
}

// Create and run a chain
final chain = Chain<UserInput, ProcessedUser>('UserProcessing')
  .add(ValidateUserLink())
  .add(ProcessUserLink())
  .use(LoggingMiddleware())
  .use(PerformanceMiddleware());

final result = await chain.run(Context({'userData': userData}));

🔄 Universal Patterns Maintained

The Dart implementation maintains CodeUChain's universal patterns:

  • Same Context<T> mental model across all languages
  • Consistent Link<TInput, TOutput> interface design
  • Universal insertAs<U>() type evolution pattern
  • Compatible middleware architecture

📚 Documentation Updates

  • Added Dart to main README language support table (marked as beta)
  • Updated installation instructions with Dart package manager (beta version)
  • Added comprehensive Dart documentation with examples and beta notices
  • Updated language badge to include Dart 3.9+ support

🎊 Impact

This brings CodeUChain's total language support to 8 implementations (Python, Go, JavaScript/TypeScript, C#, Rust, C++, and now Dart), making it one of the most universally accessible composable software frameworks available.

Dart developers can now leverage CodeUChain's powerful patterns for building maintainable, testable, and composable applications while enjoying Dart's excellent developer experience and type safety.

Fixes #34

Original prompt

This section details on the original issue you should resolve

<issue_title>feat: Dart support</issue_title>
<issue_description>Support dart</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #34


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits October 15, 2025 23:42
Co-authored-by: JoshuaWink <60934381+JoshuaWink@users.noreply.github.com>
Co-authored-by: JoshuaWink <60934381+JoshuaWink@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for Dart language feat: Add complete Dart support with typed features Oct 15, 2025
Copilot AI requested a review from JoshuaWink October 15, 2025 23:46
Copy link
Contributor

@JoshuaWink JoshuaWink left a comment

Choose a reason for hiding this comment

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

Looks good, tag it as beta so users understand it may shift slightly pending usage and optimization.

  • beta note in readme
  • beta github tag attached to pr

@JoshuaWink
Copy link
Contributor

Looks good, tag it as beta so users understand it may shift slightly pending usage and optimization.

  • beta note in readme
  • beta github tag attached to pr

@copilot

Co-authored-by: JoshuaWink <60934381+JoshuaWink@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 16, 2025

Looks good, tag it as beta so users understand it may shift slightly pending usage and optimization.

  • beta note in readme...

Added beta notes to both the main README and Dart package README, plus updated version to 1.0.0-beta.1. The status now clearly indicates the implementation is feature-complete but may shift slightly pending usage and optimization. For the GitHub tag, that would need to be added at the repository level through GitHub's interface or API. (commit: ef14559)

Copilot AI changed the title feat: Add complete Dart support with typed features feat: Add complete Dart support with typed features (beta) Oct 16, 2025
Copilot AI requested a review from JoshuaWink October 16, 2025 01:45
@JoshuaWink JoshuaWink marked this pull request as ready for review October 16, 2025 01:46
@JoshuaWink JoshuaWink merged commit 8dd8d3e into main Oct 16, 2025
@JoshuaWink JoshuaWink deleted the copilot/add-dart-support branch October 16, 2025 01:47
JoshuaWink added a commit that referenced this pull request Jan 19, 2026
* Initial plan

* feat: Add complete Dart support with typed features

Co-authored-by: JoshuaWink <60934381+JoshuaWink@users.noreply.github.com>

* feat: Add complete Dart support with typed features

Co-authored-by: JoshuaWink <60934381+JoshuaWink@users.noreply.github.com>

* docs: Mark Dart implementation as beta with appropriate notices

Co-authored-by: JoshuaWink <60934381+JoshuaWink@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: JoshuaWink <60934381+JoshuaWink@users.noreply.github.com>
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.

feat: Dart support

2 participants