# Initialization

After installing the Wepin Flutter Widget SDK, the next step is to initialize the SDK. SDK initialization involves creating an instance of `WepinWidgetSDK` and using the `init()` function to proceed.

## **Import SDK**

To use the Wepin Flutter Widget SDK, you first need to import the SDK. Add the following import statements:

```dart
import 'package:wepin_flutter_widget_sdk/wepin_flutter_widget_sdk.dart';
import 'package:wepin_flutter_widget_sdk/wepin_flutter_widget_sdk_type.dart';
```

## **Creating the WepinWidgetSDK Instance**

Before creating an instance of `WepinWidgetSDK`, you must register your app's Android/iOS information in the Wepin Workspace.

{% content-ref url="/pages/jbQ0WaKQeMfxsY4nDVeP" %}
[App Registration](/en/archive/getstarted/registration.md)
{% endcontent-ref %}

Using the registered app information, create an instance of `WepinWidgetSDK`. In the `state init` stage of the `main.dart` file, create and initialize the `WepinWidgetSDK` instance as follows:

{% code title="main.dart" %}

```dart
WepinWidgetSDK wepinSDK = WepinWidgetSDK(
    wepinAppKey: wepinAppKey, 
    wepinAppId: wepinAppId
);
```

{% endcode %}

## **SDK Initialization (init)**

When initializing the Wepin Flutter Widget SDK, you can define the required widget properties.

```dart
await wepinSDK.init({WidgetAttributes? attributes});
```

#### **Parameters**

* **attributes** `<WidgetAttributes>`***optional*** -  Widget properties to define during initialization.
  * **defaultLanguage** `<String>`: \
    Set the default language of the widget. The default value is `ko`, and currently supported languages are `en`, `ja` and `ko`.
  * **defaultCurrency** `<String>`\
    Set the default currency of the widget. The default value is `KRW`, and currently supported currencies are `USD`, `JPY`and `KRW`.

#### **Return Value**

* **Future\<void>**

#### **Example**

```dart
await wepinSDK.init(WidgetAttributes(
    defaultLanguage: 'ko',
    defaultCurrency: 'KRW',
));
```

## **Checking Initialization Status (isInitialized)**

You can check whether the WepinSDK has been successfully initialized.

```dart
bool isInitialized = wepinSDK.isInitialized();
```

#### **Parameters**

* **None**

#### **Return Value**

* **\<bool>**\
  Returns `true` if the initialization was successful, and `false` if it failed.

#### **Example**

```dart
await wepinSDK.init(WidgetAttributes(
    defaultLanguage: 'ko',
    defaultCurrency: 'KRW',
));

if (wepinSDK.isInitialized()) {
  print('WepinSDK is initialized!');
}
```

## **Changing Language and Currency (changeLanguage)**

You can change the language and currency of the widget.

```dart
wepinSDK.changeLanguage({String language, String currency});
```

#### **Parameters**

* **language** `<String>`\
  Specifies the language to be displayed in the widget. Currently supported languages are `en,` `ja` and `ko`.
* **currency** `<String>`\
  Specifies the currency to be displayed in the widget. Currently supported currencies are `USD`, `JPY` and `KRW`.

#### **Example**

```dart
wepinSDK.changeLanguage(
  language: 'ko',
  currency: 'KRW'
);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wepin.io/en/widget-integration/flutter-sdk/widget/initialization.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
