nabil6391 / graphview

Flutter GraphView is used to display data in graph structures. It can display Tree layout, Directed and Layered graph. Useful for Family Tree, Hierarchy View.
MIT License
415 stars 115 forks source link

Strings not accepted as Node ids #100

Closed RottenSchnitzel closed 1 year ago

RottenSchnitzel commented 1 year ago

Even though #44 is closed and apparently resolved it is not working for me:

This raises the error type 'String' is not a subtype of type 'int?' in type cast.

@override
void initState() {
  final node0 = Node.Id("0");
  final node1 = Node.Id("1");
  graph.addEdge(node0, node1);
  builder
    ..siblingSeparation = (10)
    ..levelSeparation = (50)
    ..subtreeSeparation = (100)
    ..orientation = (BuchheimWalkerConfiguration.ORIENTATION_LEFT_RIGHT);
}
nabil6391 commented 1 year ago

Please share the error message and the stacktrace

RottenSchnitzel commented 1 year ago

Sure. Here is everything the console gave me:

════════ Exception caught by widgets library ═══════════════════════════════════
The following _CastError was thrown building GraphView(dirty, state: _GraphViewState#f555c):
type 'String' is not a subtype of type 'int' in type cast

The relevant error-causing widget was
GraphView
lib/common/tree.dart:72
When the exception was thrown, this was the stack
#0      _TreeState.build.<anonymous closure> (package:Test/common/tree.dart:80:41)
#1      _GraphView._extractChildren.<anonymous closure> (package:graphview/GraphView.dart:103:40)
#2      List.forEach (dart:core-patch/growable_array.dart:416:8)
#3      _GraphView._extractChildren (package:graphview/GraphView.dart:102:17)
#4      new _GraphView (package:graphview/GraphView.dart:86:35)
#5      _GraphViewState.build (package:graphview/GraphView.dart:69:14)
#6      StatefulElement.build (package:flutter/src/widgets/framework.dart:5080:27)
#7      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4968:15)
#8      StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5133:11)
#9      Element.rebuild (package:flutter/src/widgets/framework.dart:4690:5)
#10     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4950:5)
#11     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5124:11)
#12     ComponentElement.mount (package:flutter/src/widgets/framework.dart:4944:5)
...     Normal element mounting (73 frames)
#85     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3953:16)
#86     MultiChildRenderObjectElement.inflateWidget (package:flutter/src/widgets/framework.dart:6512:36)
#87     MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6524:32)
...     Normal element mounting (9 frames)
#96     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3953:16)
#97     MultiChildRenderObjectElement.inflateWidget (package:flutter/src/widgets/framework.dart:6512:36)
#98     MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6524:32)
...     Normal element mounting (28 frames)
#126    Element.inflateWidget (package:flutter/src/widgets/framework.dart:3953:16)
#127    MultiChildRenderObjectElement.inflateWidget (package:flutter/src/widgets/framework.dart:6512:36)
#128    MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6524:32)
...     Normal element mounting (326 frames)
#454    Element.inflateWidget (package:flutter/src/widgets/framework.dart:3953:16)
#455    MultiChildRenderObjectElement.inflateWidget (package:flutter/src/widgets/framework.dart:6512:36)
#456    MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6524:32)
...     Normal element mounting (446 frames)
#902    Element.inflateWidget (package:flutter/src/widgets/framework.dart:3953:16)
#903    Element.updateChild (package:flutter/src/widgets/framework.dart:3682:18)
#904    RenderObjectToWidgetElement._rebuild (package:flutter/src/widgets/binding.dart:1176:16)
#905    RenderObjectToWidgetElement.mount (package:flutter/src/widgets/binding.dart:1145:5)
#906    RenderObjectToWidgetAdapter.attachToRenderTree.<anonymous closure> (package:flutter/src/widgets/binding.dart:1092:18)
#907    BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2682:19)
#908    RenderObjectToWidgetAdapter.attachToRenderTree (package:flutter/src/widgets/binding.dart:1091:13)
#909    WidgetsBinding.attachRootWidget (package:flutter/src/widgets/binding.dart:926:7)
#910    WidgetsBinding.scheduleAttachRootWidget.<anonymous closure> (package:flutter/src/widgets/binding.dart:906:7)
#914    _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:192:26)
(elided 3 frames from class _Timer and dart:async-patch)
════════════════════════════════════════════════════════════════════════════════
D/EGL_emulation( 8303): app_time_stats: avg=5484.56ms min=5484.56ms max=5484.56ms count=1
nabil6391 commented 1 year ago

Cannot reproduce the issue