mongodb - 未处理的异常:'package:realm_dart/src/helpers.dart':错误:第 26 行 pos 3:找不到本机函数'Helpers_invokeStatic'(2 个参数)
问题描述
未处理的异常:'package:realm_dart/src/helpers.dart':错误:第 26 行 pos 3:找不到本机函数'Helpers_invokeStatic'(2 个参数)
在启动应用程序时,它可以正常工作并获取数据,但是当我重新启动应用程序时,它会抛出上述错误。
主要.dart
void ints() {
print("initState");
var config = new Configuration();
config.schema.add(Car);
var realm = new Realm(config);
realm.write(() {
print("realm write callback");
var car = realm.create(new Car()..make = "Audi");
print("The car is ${car.make}");
car.make = "VW";
print("The car is ${car.make}");
});
var objects = realm.objects<Car>();
var indexedCar = objects[1];
print('here');
print("The indexedCar is ${indexedCar.make}");
}
配置.dart
add(Type type) {
print(type);
var schema = Helpers.invokeStatic(type, "getSchema");
//set the static field on the T class.
TypeStaticProperties.setValue(type, "schema", schema);
// _generateSchema(type);
innerList.add(type);
}
助手.dart
class Helpers {
static DateTime createDateTime(int miliseconds) {
return DateTime.fromMillisecondsSinceEpoch(miliseconds, isUtc: true);
}
static dynamic invokeStatic(Type type, String name) native "Helpers_invokeStatic";
}
解决方案
推荐阅读
- pandas - Pandas groupby agg nunique 许多列
- python - Azure edge modules cannot receive direct method requests
- linux - 为什么 sudo -i 需要绝对路径来运行脚本?
- cookies - 如果 API 位于不同的子域,Safari 13+ 会阻止第三方 cookie
- android - 添加新的 LiveData 项时适配器不会更新
- javascript - MongoError:拓扑已关闭,请连接(client.close 和 client.connect 问题)
- apache-kafka - Kafka 日志未在给定的保留时间内存储
- jetbrains-ide - GoLand:将终端移动到编辑器的快捷方式
- visual-studio-code - 按 Enter 时 vs 代码无法正常工作
- javascript - Javascript - 如何在多个模块中定义一个类?