create static method

Recorder create(
  1. RecorderConfiguration config
)

Creates a new instance of the Recorder.

This method initializes a recorder instance using the provided config.

Record while in background mode

If using permission package, ensure that the location permission is granted using await Permission.locationAlways If the recorder needs to function while the app is in the background, ensure that background location updates are enabled as follows:

final posSensor = dataSource!.getConfiguration(DataType.position);
posSensor.allowsBackgroundLocationUpdates = true;
dataSource.setConfiguration(type: DataType.position, config: posSensor);

Also make sure the Info.plist and the AndroidManifest.xml files are updated accordingly.

Parameters

  • IN config: The recorder configuration.

Returns

Throws

An exception if the recorder instance cannot be created.

Implementation

static Recorder create(final RecorderConfiguration config) {
  final String resultString = GemKitPlatform.instance.callCreateObject(
    jsonEncode(<String, Object>{'class': 'Recorder', 'args': config}),
  );
  final dynamic decodedVal = jsonDecode(resultString);
  return Recorder.init(decodedVal['result']);
}