首页 > 解决方案 > 未处理的异常:'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";
}

标签: mongodbflutterrealmmobile-applicationlocal-database

解决方案


推荐阅读