fromPath static method

Future<Config> fromPath(
  1. String configPath
)

Create config

configPath Path to *.json config file

Implementation

static Future<Config> fromPath(String configPath) async {
  DllHandler handler = await DllHandler.create();

  configPath = "${handler.assetsPath}/$configPath";

  Pointer<Utf8> data = configPath.toNativeUtf8();
  Pointer<Pointer<Void>> exception = WebFrameworkException.createException();

  CreateConfigFromPath function = handler.instance
      .lookupFunction<CreateConfigFromPath, CreateConfigFromPath>(
          "createConfigFromPath");

  Pointer<Void> implementation = function.call(data, exception);

  malloc.free(data);

  WebFrameworkException.checkException(exception, handler);

  return Config._constructor(implementation, handler);
}