zerosettle 0.0.1 copy "zerosettle: ^0.0.1" to clipboard
zerosettle: ^0.0.1 copied to clipboard

ZeroSettle SDK for Flutter — Merchant of Record web checkout.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:zerosettle/zerosettle.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';
  String _priceResult = '';
  final _zeroSettlePlugin = ZeroSettle();

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  Future<void> initPlatformState() async {
    String platformVersion;
    try {
      platformVersion =
          await _zeroSettlePlugin.getPlatformVersion() ??
              'Unknown platform version';
    } on PlatformException {
      platformVersion = 'Failed to get platform version.';
    }

    if (!mounted) return;

    setState(() {
      _platformVersion = platformVersion;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Text('Running on: $_platformVersion'),
              const SizedBox(height: 24),
              ElevatedButton(
                onPressed: () async {
                  await _zeroSettlePlugin.initialize('my-secret-api-key');
                  print('SDK Initialize call finished!');
                },
                child: const Text('Initialize SDK'),
              ),
              const SizedBox(height: 16),
              ElevatedButton(
                onPressed: () async {
                  final price = await _zeroSettlePlugin.getExamplePrice();
                  setState(() {
                    _priceResult = '${price.formatted} (${price.amountMicros} micros)';
                  });
                  print('Got price: $price');
                },
                child: const Text('Get Example Price'),
              ),
              if (_priceResult.isNotEmpty) ...[
                const SizedBox(height: 16),
                Text(_priceResult, style: const TextStyle(fontSize: 18)),
              ],
            ],
          ),
        ),
      ),
    );
  }
}
2
likes
0
points
178
downloads

Publisher

verified publisherzerosettle.io

Weekly Downloads

ZeroSettle SDK for Flutter — Merchant of Record web checkout.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on zerosettle

Packages that implement zerosettle