# DefaultCreationExtrasKt

Added in 2.9.0

*** ** * ** ***


```
public final class DefaultCreationExtrasKt
```

<br />

*** ** * ** ***

## Summary

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/viewmodel/CreationExtras` | `https://developer.android.com/reference/androidx/lifecycle/viewmodel/testing/DefaultCreationExtrasKt#DefaultCreationExtras()()` Creates a default instance of `https://developer.android.com/reference/androidx/lifecycle/viewmodel/CreationExtras` pre-configured with all keys required to use `https://developer.android.com/reference/androidx/lifecycle/SavedStateHandle`. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/viewmodel/CreationExtras` | `https://developer.android.com/reference/androidx/lifecycle/viewmodel/testing/DefaultCreationExtrasKt#DefaultCreationExtras(androidx.savedstate.SavedState)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/savedstate/SavedState defaultArgs)` Creates a default instance of `https://developer.android.com/reference/androidx/lifecycle/viewmodel/CreationExtras` pre-configured with all keys required to use `https://developer.android.com/reference/androidx/lifecycle/SavedStateHandle`, with the specified `https://developer.android.com/reference/androidx/lifecycle/viewmodel/testing/package-summary#DefaultCreationExtras(androidx.savedstate.SavedState)` as the `https://developer.android.com/reference/androidx/lifecycle/package-summary#DEFAULT_ARGS_KEY()`. |

## Public methods

### DefaultCreationExtras

Artifact: [androidx.lifecycle:lifecycle-viewmodel-testing](https://developer.android.com/jetpack/androidx/releases/lifecycle) [View Source](https://cs.android.com/search?q=file:androidx/lifecycle/viewmodel/testing/DefaultCreationExtras.kt+function:DefaultCreationExtras) Added in [2.9.0](https://developer.android.com/jetpack/androidx/releases/lifecycle#2.9.0)

```
public static final @NonNull CreationExtras DefaultCreationExtras()
```

Creates a default instance of `https://developer.android.com/reference/androidx/lifecycle/viewmodel/CreationExtras` pre-configured with all keys required to use `https://developer.android.com/reference/androidx/lifecycle/SavedStateHandle`.

This function sets up the instance with:

- A fake `https://developer.android.com/reference/androidx/savedstate/SavedStateRegistryOwner` assigned to `https://developer.android.com/reference/androidx/lifecycle/package-summary#SAVED_STATE_REGISTRY_OWNER_KEY()`.

- A fake `https://developer.android.com/reference/androidx/lifecycle/ViewModelStoreOwner` assigned to `https://developer.android.com/reference/androidx/lifecycle/package-summary#VIEW_MODEL_STORE_OWNER_KEY()`, containing an empty `https://developer.android.com/reference/androidx/lifecycle/ViewModelStore`.

### DefaultCreationExtras

Artifact: [androidx.lifecycle:lifecycle-viewmodel-testing](https://developer.android.com/jetpack/androidx/releases/lifecycle) [View Source](https://cs.android.com/search?q=file:androidx/lifecycle/viewmodel/testing/DefaultCreationExtras.kt+function:DefaultCreationExtras)

```
public static final @NonNull CreationExtras DefaultCreationExtras(@NonNull SavedState defaultArgs)
```

Creates a default instance of `https://developer.android.com/reference/androidx/lifecycle/viewmodel/CreationExtras` pre-configured with all keys required to use `https://developer.android.com/reference/androidx/lifecycle/SavedStateHandle`, with the specified `https://developer.android.com/reference/androidx/lifecycle/viewmodel/testing/package-summary#DefaultCreationExtras(androidx.savedstate.SavedState)` as the `https://developer.android.com/reference/androidx/lifecycle/package-summary#DEFAULT_ARGS_KEY()`.

This function sets up the instance with:

- A fake `https://developer.android.com/reference/androidx/savedstate/SavedStateRegistryOwner` assigned to `https://developer.android.com/reference/androidx/lifecycle/package-summary#SAVED_STATE_REGISTRY_OWNER_KEY()`.

- A fake `https://developer.android.com/reference/androidx/lifecycle/ViewModelStoreOwner` assigned to `https://developer.android.com/reference/androidx/lifecycle/package-summary#VIEW_MODEL_STORE_OWNER_KEY()`, containing an empty `https://developer.android.com/reference/androidx/lifecycle/ViewModelStore`.