setFeatureToggleDirectory function
Sets the directory where the feature toggle file is located. If the feature toggle file is found in the specified directory, it will be read by the Runtime Core. Otherwise, the feature toggle will be skipped.
Implementation
Future<void> setFeatureToggleDirectory(String tempDir) async {
const featureToggleFileName = 'arcgis_runtime_feature_set.txt';
const assetPath = 'packages/arcgis_maps/assets/$featureToggleFileName';
try {
final byteData = await rootBundle.load(assetPath);
final tempFile = File('$tempDir/$featureToggleFileName');
await tempFile.writeAsBytes(byteData.buffer.asUint8List());
final tempDirectory = _CString(tempDir);
_withThrowingErrorHandler((errorHandler) {
runtimecore.RT_ArcGISRuntimeEnvironment_setFeatureToggleDirectory(
tempDirectory.bytes,
errorHandler,
);
});
// Do nothing if the file could not be set.
// ignore: avoid_catching_errors, unused_catch_clause
} on FlutterError catch (e) {
// Catch specific Flutter errors related to Flutter's asset loading.
// Do nothing
// ignore: unused_catch_clause
} on Exception catch (e) {
// Catch other exceptions
// Do nothing
}
}