Skip to content

Conversation

@mastermakrela
Copy link

The original code used entry.value.contains('class ${annotation.element.name} ') which expected a space after class names. When Flutter's formatter formatted long declarations like:

class VeryLongClassNameThatExceedsTheEightyCharacterLimit
    extends SomeBaseClass {

The space was replaced with a newline, causing the match to fail and breaking the build with "No element" errors.

Changes:

  • Updated packages/brick_build/lib/src/builders/model_dictionary_builder.dart:67
  • Changed from string match to RegExp(r'class\s+${annotation.element.name}\s*')
  • Now correctly handles spaces, tabs, and newlines after class names

Testing:

  • Verified regex matches all class declaration formats (with/without line breaks)
  • Tested with various whitespace combinations
  • Maintains backward compatibility with existing code

@ai-context-bot
Copy link

❌ AGENTS.md is missing from repository root

  1. Create AGENTS.md file at the root of your repository
  2. AI-Generated Content Suggestions:
  3. Project Overview & Purpose

What should AGENTS.md contain?

Document the "why" behind your codebase for AI assistants:

  • Purpose: Why this repo exists and what problem it solves
  • Architecture: Key design patterns and structure
  • Tech Stack: Main technologies and why they were chosen
  • Gotchas: Non-obvious constraints or issues

See examples for inspiration.


AI Context Bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

build_runner fails when flutter formatter breaks lines after long class names

1 participant