Updated finalizer based on latest dart_api