Skip to content

Fix: edge_types.dart uses non-existent EdgeType enum #12

Description

@johndpope

Problem

The edge_types.dart example file references an EdgeType enum that doesn't exist in the library. The library uses EdgeTypes which is an abstract class with static const String values.

Affected File

  • packages/xyflow_flutter/example/lib/examples/edge_types.dart

Current Code (Broken)

EdgeType _selectedEdgeType = EdgeType.bezier;  // ❌ EdgeType enum doesn't exist

Edge<Map<String, dynamic>>(
  id: 'e-bezier',
  source: 'source',
  target: 'bezier',
  type: EdgeType.bezier,  // ❌ Wrong type
  data: {'label': 'Bezier'},
),

Library API

The library defines EdgeTypes as:

abstract class EdgeTypes {
  EdgeTypes._();
  static const String defaultEdge = 'default';
  static const String straight = 'straight';
  static const String step = 'step';
  static const String smoothStep = 'smoothStep';
  static const String simpleBezier = 'simpleBezier';
}

Solution

Update edge_types.dart to use EdgeTypes (String constants) instead of EdgeType (non-existent enum):

String _selectedEdgeType = EdgeTypes.defaultEdge;

Edge<Map<String, dynamic>>(
  id: 'e-bezier',
  source: 'source',
  target: 'bezier',
  type: EdgeTypes.defaultEdge,  // ✅ Use string type
  data: {'label': 'Bezier'},
),

@claude please fix this issue

Activity

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

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