> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crossmint.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CrossmintExportPrivateKeyButton

> Flutter Class

**Class**

Export private key button matching the official Crossmint RN SDK `ExportPrivateKeyButton` component.

```dart theme={null}
class CrossmintExportPrivateKeyButton extends StatefulWidget
```

Only renders when `wallet.canExportPrivateKey` is true (email/phone signers).
Returns `SizedBox.shrink` otherwise.

Headless consumers can supply a `childBuilder` to swap the Material
default button for their own widget while keeping the eligibility check
and loading state management. Pure-headless consumers can bypass this
widget entirely and call `wallet.exportPrivateKey()` directly from their
own button.

## Constructors

### CrossmintExportPrivateKeyButton

```dart theme={null}
const CrossmintExportPrivateKeyButton({
  super.key,
  required this.wallet,
  this.onExported,
  this.onError,
  this.childBuilder,
})
```

## Properties

### wallet

```dart theme={null}
final CrossmintRuntimeWalletBase wallet
```

Wallet whose private key will be exported. The button only renders when `CrossmintRuntimeWalletBase.canExportPrivateKey` is true (email/phone signer wallets).

### onExported

```dart theme={null}
final VoidCallback? onExported
```

Called after the export flow completes successfully.

### onError

```dart theme={null}
final void Function(Object error)? onError
```

Called when the export flow throws. Receives the underlying exception so consumers can surface a localized error message.

### childBuilder

```dart theme={null}
final CrossmintExportPrivateKeyButtonBuilder? childBuilder
```

Optional builder for the button visual. When `null`, falls back to the React Native parity Material `OutlinedButton` with a themed `CircularProgressIndicator` while the export is in flight. When non-null, the builder is invoked whenever the wallet is eligible to export and receives the current `isLoading` flag plus an `onExport` callback that the consumer wires to their own tap target. The `onExport` callback is `null` while loading so consumers can disable their button directly without a separate mounted check.

## Methods

### createState

```dart theme={null}
State<CrossmintExportPrivateKeyButton> createState()
```
