WEPIN Developer Documentation
WepinBlogContact
한국어
한국어
  • 시작하기
    • 소개
  • 위핀
    • 특징
    • 아키텍처
      • 키 생성
      • 서명
      • 키 백업
    • 워크스페이스
      • 앱 등록 및 키 발급
      • 네트워크 및 자산 추가
      • 위젯 디자인
    • 지원 블록체인
    • 계정 추상화
  • 로그인
    • 개요
    • 소셜 로그인 인증 프로바이더
      • Email/Password
      • Google
      • Apple
      • Discord
      • Naver
      • Facebook
      • Line
      • Kakao
    • 사용자 인터페이스
    • 로그인 일원화
    • 리소스
  • 위젯 연동
    • 사전 준비
    • Web: JavaScript SDK
      • 로그인
        • 설치
        • 초기화하기
        • 메서드
      • 핀 패드
        • 설치
        • 초기화하기
        • 메서드
      • 위젯
        • 설치
        • 초기화하기
        • 메서드
        • 확인하기
      • 프로바이더
        • Ethereum Provider
        • Kaia Provider
        • Solana Provider
        • Wagmi Connector
      • 월렛 어댑터
        • Solana Wallet Adapter
    • Android: Java & Kotlin SDK
      • 로그인
        • 설치
        • 초기화하기
        • 메서드
      • 핀 패드
        • 설치
        • 초기화하기
        • 메서드
      • 위젯
        • 설치
        • 초기화하기
        • 메서드
    • iOS: Swift SDK
      • 로그인
        • 설치
        • 초기화하기
        • 메서드
      • 핀 패드
        • 설치
        • 초기화하기
        • 메서드
      • 위젯
        • 설치
        • 초기화하기
        • 메서드
    • Flutter SDK
      • 로그인
        • 설치
        • 초기화하기
        • 메서드
      • 위젯
        • 설치
        • 초기화하기
        • 메서드
        • 확인하기
      • 핀 패드
        • 설치
        • 초기화하기
        • 메서드
    • React Native SDK
      • 로그인
        • 설치
        • 초기화
        • 메서드
    • Unity SDK
      • 설치
      • 초기화하기
      • 메서드
      • 확인하기
    • Compose Multiplatform SDK
      • 로그인
        • 설치
        • 초기화하기
        • 메서드
      • 위젯
        • 설치
        • 초기화하기
        • 메서드
        • 확인하기
  • API
    • 개요
    • 등록 절차
    • 로그인
    • 지갑 생성 및 관리
    • 토큰 및 NFT 조회
    • 트랜잭션
  • Deprecated
    • Web: JavaScript SDK
      • SDK
        • 설치
        • 초기화하기
        • 메서드
        • 확인하기
      • 프로바이더
        • Ethereum Provider
      • Wagmi Connector
    • Android: Java & Kotlin SDK
      • 설치
      • 초기화하기
      • 메서드
      • 확인하기
    • iOS: Swift SDK
      • 설치
      • 초기화하기
      • 메서드
      • 확인하기
    • Flutter SDK
      • 설치
      • 초기화하기
      • 메서드
      • 확인하기
    • React Native SDK
      • 설치
      • 초기화하기
      • 메서드
      • 확인하기
      • 프로바이더
        • EVM 호환
  • 기타
    • 로고 & 브랜드 가이드라인
Powered by GitBook
On this page
  • 초기화하기
  • WepinOptions
  • isInitialized
  • DeepLink / Universal Link 처리하기

Was this helpful?

  1. Deprecated
  2. Flutter SDK

초기화하기

Wepin widget flutter SDK를 초기화하는 방법입니다.

초기화하기

먼저 위핀 인스턴스를 생성하고 앱 위젯의 BuildContext와 앱 등록 후 할당 받은 앱 ID와 앱 키로 위핀 위젯을 초기화 합니다.

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() // 딥링크 처리함수 
}

@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

초기화에 사용되는 파라미터 WepinOptions 클래스의 인터페이스는 아래와 같습니다.

public class WepinOptions {
	final String _appId; // 앱 아이디
  final String _appKey; // 앱 키
  final WidgetAttributes _widgetAttributes; // 위젯 속성
}

public class WidgetAttributes {
final String _defaultLanguage;
  final String _defaultCurrency;
}
  • appId: String 앱 등록시 할당 받은 ID

  • appKey: String 앱 등록시 할당 받은 키 값

  • attributes: Object (optional) 위핀 위젯의 속성 값

    • defaultLanguage: String 위젯 기본 언어 설정, 기본 값은 ko입니다. 현재 지원하는 언어는 en, ko 이렇게 2가지 입니다.

    • defaultCurrency: String 위젯 기본 통화 설정, 기본 값은 KRW입니다. 현재 지원하는 통화는 USD, KRW 이렇게 2가지 입니다.

isInitialized

isInitialized 메서드를 이용해서 Wepin이 정상적으로 초기화 되었는지 확인할 수 있습니다.

반환값은 아래와 같습니다.

  • bool init 결괏값, init이 정상적으로 잘 된 경우 true 실패한 경우 false 를 반환합니다.

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

DeepLink / Universal Link 처리하기

앱의 Info 파일 또는 AndroidManifest에 추가한 URL schemes 을 처리하기 위해 위핀을 사용하는 앱에 아래와 같이 처리하는 코드를 추가합니다.

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');
      });
    }
  }
Previous설치Next메서드

Last updated 8 months ago

Was this helpful?