Full code at: https://github.com/Murmurl912/flutter_code_push_flutter_eval/blob/main/hot_update/test/generate_binding.dart
Error is thrown in BridgeTypeRef.toJson, ref = null
class BridgeTypeRef {
/// Reference a type by its spec (library URI and name)
const BridgeTypeRef(this.spec, [this.typeArgs = const []])
: cacheId = null,
gft = null,
ref = null;
/// Reference a type by its local in-context name
/// (e.g. a type parameter name such as T)
const BridgeTypeRef.ref(this.ref, [this.typeArgs = const []])
: cacheId = null,
gft = null,
spec = null;
/// Internal use only.
const BridgeTypeRef.type(this.cacheId, [this.typeArgs = const []])
: ref = null,
gft = null,
spec = null;
/// Reference a generic function type.
/// Currently maps to [CoreTypes.function]
const BridgeTypeRef.genericFunction(this.gft)
: typeArgs = const [],
ref = null,
cacheId = null,
spec = null;
/// Load a type ref from its JSON representation.
factory BridgeTypeRef.fromJson(Map<String, dynamic> json) {
final id = json['id'];
final ta = [
for (final arg in json['typeArgs']) BridgeTypeRef.fromJson(arg)
];
if (id != null) {
return BridgeTypeRef.type(id, ta);
}
final gft = json['gft'];
if (gft != null) {
return BridgeTypeRef.genericFunction(gft);
}
final unresolved = json['unresolved'];
if (unresolved != null) {
return BridgeTypeRef(BridgeTypeSpec.fromJson(json['unresolved']), ta);
}
return BridgeTypeRef.ref(json['ref'], ta);
}
final int? cacheId;
final String? ref;
final BridgeFunctionDef? gft;
final BridgeTypeSpec? spec;
final List<BridgeTypeRef> typeArgs;
/// Convert the type ref to its JSON representation.
Map<String, dynamic> toJson() => {
if (cacheId != null)
'id': cacheId!
else if (spec != null)
'unresolved': spec!.toJson()
else
'ref': ref!, /// ref is null
'typeArgs': [for (final t in typeArgs) t.toJson()]
};
}
serialize failed: Null check operator used on a null value
#0 BridgeTypeRef.toJson (package:dart_eval/src/eval/bridge/declaration/type.dart:134:21)
#1 nestToJson (flutter_code_push_flutter_eval/hot_update/test/generate_binding.dart:33:27)
#2 nestToJson (flutter_code_push_flutter_eval/hot_update/test/generate_binding.dart:27:7)
#3 nestToJson (flutter_code_push_flutter_eval/hot_update/test/generate_binding.dart:34:7)
#4 nestToJson (flutter_code_push_flutter_eval/hot_update/test/generate_binding.dart:27:7)
#5 nestToJson (flutter_code_push_flutter_eval/hot_update/test/generate_binding.dart:34:7)
#6 nestToJson (flutter_code_push_flutter_eval/hot_update/test/generate_binding.dart:19:7)
#7 nestToJson (flutter_code_push_flutter_eval/hot_update/test/generate_binding.dart:27:7)
#8 nestToJson (flutter_code_push_flutter_eval/hot_update/test/generate_binding.dart:34:7)
#9 nestToJson (flutter_code_push_flutter_eval/hot_update/test/generate_binding.dart:27:7)
#10 nestToJson (flutter_code_push_flutter_eval/hot_update/test/generate_binding.dart:34:7)
#11 nestToJson (flutter_code_push_flutter_eval/hot_update/test/generate_binding.dart:27:7)
#12 nestToJson (flutter_code_push_flutter_eval/hot_update/test/generate_binding.dart:27:7)
Full code at: https://github.com/Murmurl912/flutter_code_push_flutter_eval/blob/main/hot_update/test/generate_binding.dart
Error is thrown in BridgeTypeRef.toJson, ref = null
serialize failed: Null check operator used on a null value
#0 BridgeTypeRef.toJson (package:dart_eval/src/eval/bridge/declaration/type.dart:134:21)
#1 nestToJson (flutter_code_push_flutter_eval/hot_update/test/generate_binding.dart:33:27)
#2 nestToJson (flutter_code_push_flutter_eval/hot_update/test/generate_binding.dart:27:7)
#3 nestToJson (flutter_code_push_flutter_eval/hot_update/test/generate_binding.dart:34:7)
#4 nestToJson (flutter_code_push_flutter_eval/hot_update/test/generate_binding.dart:27:7)
#5 nestToJson (flutter_code_push_flutter_eval/hot_update/test/generate_binding.dart:34:7)
#6 nestToJson (flutter_code_push_flutter_eval/hot_update/test/generate_binding.dart:19:7)
#7 nestToJson (flutter_code_push_flutter_eval/hot_update/test/generate_binding.dart:27:7)
#8 nestToJson (flutter_code_push_flutter_eval/hot_update/test/generate_binding.dart:34:7)
#9 nestToJson (flutter_code_push_flutter_eval/hot_update/test/generate_binding.dart:27:7)
#10 nestToJson (flutter_code_push_flutter_eval/hot_update/test/generate_binding.dart:34:7)
#11 nestToJson (flutter_code_push_flutter_eval/hot_update/test/generate_binding.dart:27:7)
#12 nestToJson (flutter_code_push_flutter_eval/hot_update/test/generate_binding.dart:27:7)