WEPIN Developer Documentation
WepinBlogContact
English
English
  • Get Started
    • Introduction
  • Wepin
    • Features
    • Architecture
      • Key Generation
      • Signing
      • Key Backup
    • Workspace
      • App Registration and Key Issuance
      • Networks and Assets Addition
      • Widget Design
    • Supported blockchains
    • Account Abstraction
  • login
    • Overview
    • Social Login Auth Providers
      • Email/Password
      • Google
      • Apple
      • Discord
      • Naver
      • Facebook
      • Line
      • Kakao
    • User Interface
    • Simplified Login
    • Resource
  • Widget Integration
    • Prerequisites
    • Web: JavaScript SDK
      • Login Library
        • Installation
        • Initialization
        • Methods
      • PIN Pad Library
        • Installation
        • Initialization
        • Methods
      • Widget
        • Installation
        • Initialization
        • Methods
        • Final Review
      • Provider
        • Ethereum Provider
        • Kaia Provider
        • Solana Provider
        • Wagmi Connector
      • Wallet Adapter
        • Solana Wallet Adapter
    • Android: Java & Kotlin SDK
      • Login Library
        • Installation
        • Initialization
        • Methods
      • PIN Pad Library
        • Installation
        • Initialization
        • Methods
      • Widget Library
        • Installation
        • Initialization
        • Methods
    • iOS: Swift SDK
      • Login Library
        • Installation
        • Initialization
        • Methods
      • PIN Pad Library
        • Installation
        • Initialization
        • Methods
      • Widget Library
        • installation
        • initialization
        • Methods
    • Flutter SDK
      • Login Library
        • Installation
        • Initialization
        • Methods
      • Widget
        • Installation
        • Initialization
        • Methods
        • Final Review
      • PIN Pad Library
        • Installation
        • Initialization
        • Methods
    • React Native SDK
      • Login Library
        • Installation
        • Initialization
        • Methods
    • Unity SDK
      • Installation
      • Initialization
      • Methods
      • Final Review
    • Compose Multiplatform SDK
      • Login Library
        • Installation
        • Initialization
        • Methods
      • Widget
        • Installation
        • Initialization
        • Methods
        • Final Review
  • API
    • Overview
    • Registration
    • Login
    • Wallet
    • Token and NFT
    • Transaction
  • Deprecated
    • Web: JavaScript SDK
      • SDK
        • Installation
        • Initialization
        • Methods
        • Final Review
      • Provider
        • EVM-Compatible Networks
      • Wagmi Connector
    • Android: Java & Kotlin SDK
      • Installation
      • Initialization
      • Methods
      • Final Review
    • iOS: Swift SDK
      • Installation
      • Initialization
      • Methods
      • Final Review
    • Flutter SDK
      • Installation
      • Initialization
      • Methods
      • Final Review
    • React Native SDK
      • Installation
      • Initialization
      • Methods
      • Final Review
      • Providers
        • Ethereum Providers
  • MISC
    • Logo & Brand
Powered by GitBook
On this page
  • Initialize
  • WepinOptions
  • isInitialized
  • Handle DeepLink / Universal Link

Was this helpful?

  1. Deprecated
  2. Flutter SDK

Initialization

Here is how to initialize the Wepin widget flutter SDK.

Initialize

First, create an instance of the Wepin widget. Then, use the BuildContext of the app widget, the App ID and App Key assigned after app registration to initialize the instance.

import 'package:wepin_flutter/wepin.dart';
import 'package:wepin_flutter/wepin_delegate.dart';
import 'package:wepin_flutter/wepin_inputs.dart';
import 'package:wepin_flutter/wepin_outputs.dart';

final String _appId = "app_id_eg12sf3491azgs520";
final String _appKey = "ak_test_ghq1D5s1sfG234sbnhdsw24mnovk313";
late Wepin _wepin;

@override
void initState() {
  super.initState();
  _wepin = Wepin();
	_handleDeepLink() // Deep Link Handling Function
}

@override
Widget build(BuildContext context) {
  print('SampleApp_build');
  return MaterialApp(
    home: Scaffold(
      appBar: AppBar(
        title: const Text('Wepin Flutter Example'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            ElevatedButton(
                onPressed: () => _initialize(context),
                child: const Text('initialize')),
					],
        ),
      ),
    ),
  );
}


void _initialize(BuildContext context) {
    WidgetAttributes widgetAttributes = WidgetAttributes('ko', 'krw');
    WepinOptions wepinOptions =
        WepinOptions(_appId, _appSdkKey, widgetAttributes);
    _wepin.initialize(context, wepinOptions);
  }

WepinOptions

The interface of the WepinOptions class, which is used as a parameter for initialization, is as follows.

public class WepinOptions {
	final String _appId; // App ID
  final String _appKey; // App Key
  final WidgetAttributes _widgetAttributes; // Widget Attributes
}

public class WidgetAttributes {
final String _defaultLanguage;
  final String _defaultCurrency;
}
  • appId: String App ID assigned during registration

  • appKey: String App Key assigned during registration

  • attributes: Object (optional)

    Properties of the Wepin Widget

    • defaultLanguage: String The language to be displayed on the widget. The default value is ko. The currently supported languages are en and ko.

    • defaultCurrency: String The currency to be displayed on the widget. The default value is KRW. The currently supported currencies are USD and KRW.

isInitialized

You can use the isInitialized method to check if the Wepin instance has been initialized successfully.

The returned value is as follows.

  • boolean init result; true if Wepin SDK is already initialized, otherwise false.

if(_wepin.isInitialized()) {
    // Success to initialize wepin
}

Handle DeepLink / Universal Link

To handle the URL schemes added to the app's Info file or AndroidManifest for use with Wepin, add the following code to the app using Wepin.

import 'package:uni_links/uni_links.dart';

StreamSubscription? _sub;

// Handle incoming links - the ones that the app will recieve from the OS
// while already started.

  void _handleDeepLink() {
    if (!kIsWeb) {
      // It will handle app links while the app is already started - be it in
      // the foreground or in the background.
      _sub = uriLinkStream.listen((Uri? uri) {
        if (!mounted) return;
        print('got_uri: $uri');
        _wepin.handleWepinLink(uri!);
      }, onError: (Object err) {
        if (!mounted) return;
        print('got_err: $err');
      });
    }
  }
PreviousInstallationNextMethods

Last updated 1 year ago

Was this helpful?