/// Register a Dart implementation as a `{{ trait_name }}` plugin.
///
/// Forwards the `Arc<dyn {{ trait_name }}>` wrapped by `{{ struct_name }}` to
/// `{{ registry_getter }}()`. Errors from the host registry are stringified
/// for FRB transport.
pub fn {{ register_fn }}(impl_: {{ struct_name }}) -> Result<(), String> {
let registry = {{ registry_getter }}();
let mut registry = registry.write();
registry.register(impl_.field0{{ extra_args }}).map_err(|e| e.to_string())
}