Skip to content

Commit

Permalink
add key
Browse files Browse the repository at this point in the history
  • Loading branch information
jinyus committed Jan 8, 2022
1 parent 0288510 commit c17b55c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/jseen_tree.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import 'package:jseen/utils.dart';
part 'collapsable_key.dart';

class JSeenTree extends StatefulWidget {
const JSeenTree({
JSeenTree({
Key? key,
required this.json,
this.shouldParse = true,
Expand All @@ -22,7 +22,15 @@ class JSeenTree extends StatefulWidget {
this.errorWidget = kErrorWidget,
}) : assert(json is String && shouldParse || json is! String && !shouldParse,
"[shouldParse] must be true is [json] is a String\n[shouldParse] must be false if [json] is not a String"),
super(key: key);
super(
key: key ??
ValueKey(
shouldParse.hashCode ^
expandAll.hashCode ^
json.hashCode ^
indent.hashCode ^
errorWidget.hashCode,
));

/// theme specifying how the json values should look
final JSeenTheme theme;
Expand Down

0 comments on commit c17b55c

Please sign in to comment.