assignToStruct method

  1. @override
void assignToStruct(
  1. BaseOptions struct
)
override

Assigns all values to an existing struct. This method should be implemented by all InnerTaskOptions types to hydrate a struct, but not for the creation of that struct. Allocation and management of the actual structs are handled by TaskOptions.copyToNative on the wrapping options object.

Implementation

@override
void assignToStruct(bindings.BaseOptions struct) {
  switch (type) {
    case BaseOptionsType.path:
      {
        struct.model_asset_path = modelAssetPath!.copyToNative();
      }
    case BaseOptionsType.memory:
      {
        struct.model_asset_buffer = modelAssetBuffer!.copyToNative();
        struct.model_asset_buffer_count = modelAssetBuffer!.lengthInBytes;
      }
  }
}