dispose method
Releases native memory created by copyToNative.
This method is called within the IO implementation and should not be callable or even visible to end developers.
Implementation
@override
void dispose() {
assert(() {
if (isClosed) {
throw Exception(
'Attempted to call dispose on an already-disposed task options'
'object. Task options should only ever be disposed after they are at '
'end-of-life and will never be accessed again.',
);
}
if (_pointer == null) {
throw Exception(
'Attempted to call dispose on a LanguageDetectorOptions object which '
'was never used by a LanguageDetector, which you do not need to do. '
'Did you forget to create your LanguageDetector?',
);
}
return true;
}());
baseOptions.freeStructFields(_pointer!.ref.base_options);
classifierOptions.freeStructFields(_pointer!.ref.classifier_options);
calloc.free(_pointer!);
_isClosed = true;
}