samsung_wallet 1.0.2 copy "samsung_wallet: ^1.0.2" to clipboard
samsung_wallet: ^1.0.2 copied to clipboard

PlatformAndroid

Samsung Wallet Example Flutter plugin project. This plugin based Samsung Wallet Android java package file.

example/lib/main.dart

import 'dart:developer';

import 'package:flutter/material.dart';
import 'dart:async';
import 'package:samsung_wallet/samsung_wallet.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  MyApp({super.key});

  /// mandatory
  /// Check your Wallet Cards in Manage Wallet Cards which you want add Wallet Card App Integration
  static const String impressionUrl = "[ Impression Url ]";

  /// optional
  static const String countryCode = "[ CountryCode ]";

  /// mandatory
  /// Check your Wallet Cards in Samsung Wallet Partners
  static const String partnerCode = "[ Partner Code ]";

  /// mandatory
  /// Check your Wallet Cards in Manage Wallet Cards which you want add Wallet Card App Integration
  static const String cardId = "[ Card Id ]";

  /// mandatory
  /// You can get cdata to JWT Generator
  static const String cdata = "[ CData ]";

  /// mandatory
  /// Check your Wallet Cards in Manage Wallet Cards which you want add Wallet Card App Integration
  static const String clickUrl = "[ Click Url ]";

  final _samsungWalletPlugin = SamsungWallet(
      countryCode: countryCode,
      partnerCode: partnerCode,
      impressionURL: impressionUrl);

  Future<void> checkSamsungWalletSupported() async {
    try {
      await _samsungWalletPlugin.checkSamsungWalletSupported(
              partnerCode: partnerCode, countryCode: 'KR') ??
          false;
    } catch (e) {
      log("ERROR : $e");
    }
  }

  addCard() async {
    await _samsungWalletPlugin.addCardToSamsungWallet(
        cardID: cardId, cData: cdata, clickURL: clickUrl);
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Samsung Wallet Demo'),
        ),
        body: Column(
          children: [
            const Flexible(
              flex: 3,
              fit: FlexFit.loose,
              child: Center(
                  child: Text(
                'Hello Samsung Wallet!',
                style: TextStyle(fontSize: 20),
              )),
            ),
            Flexible(
              flex: 1,
              fit: FlexFit.tight,
              child: GestureDetector(
                  onTap: addCard,
                  child: Image.asset("assets/wallet_card.png")),
            )
          ],
        ),
      ),
    );
  }
}
4
likes
160
pub points
52%
popularity

Publisher

verified publishermonocsp.dev

Samsung Wallet Example Flutter plugin project. This plugin based Samsung Wallet Android java package file.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-2-Clause (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on samsung_wallet