Skip to content

Commit 3acf2f8

Browse files
committed
fix: Allow weak conversion from StringName / GDString in Variant.cast
1 parent 07f03de commit 3acf2f8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/dart/godot_dart/lib/src/variant/variant.dart

+5
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,11 @@ class Variant implements Finalizable {
207207
if (value is T) {
208208
return value;
209209
}
210+
// Allow weak conversion from StringName / GDString to Dart Strings
211+
if (T == String) {
212+
if (value is StringName) return value.toDartString() as T;
213+
if (value is GDString) return value.toDartString() as T;
214+
}
210215
return null;
211216
}
212217

0 commit comments

Comments
 (0)