hylid_bridge library
A Flutter wrapper for the Hylid Bridge JavaScript SDK.
This library provides seamless integration with Hylid's payment, authentication, and UI services on web platforms. The Hylid Bridge script is automatically loaded when you use any API - no manual setup required.
Features
- Payment processing via tradePay
- OAuth-style authentication via getAuthCode
- Native-style alerts via alert
- Automatic script injection on web
- Type-safe API with proper Dart types
Usage
import 'package:flutter_hylid_bridge/hylid_bridge.dart';
// Process a payment
await tradePay(
paymentUrl: 'https://payment-url.com/...',
success: (result) => print('Success!'),
);
// Get authorization code
await getAuthCode(
scopes: ['auth_user'],
success: (result) => print('Code: ${result.authCode?.toDart}'),
);
// Show an alert
await alert(
title: 'Hello',
content: 'Welcome to Hylid Bridge!',
);
You can also import specific categories:
import 'package:flutter_hylid_bridge/payment.dart'; // Only payment APIs
import 'package:flutter_hylid_bridge/auth.dart'; // Only auth APIs
import 'package:flutter_hylid_bridge/ui.dart'; // Only UI APIs
Extension Types
- AuthCodeResult
- Result object returned from authorization code requests.
- TradePayResult
- Result object returned from trade pay operations.
Functions
-
alert(
{String? title, String? content, String? buttonText, void success()?, void fail()?, void complete()?}) → Future< void> - Displays a native-style alert dialog.
-
ensureHylidBridgeInitialized(
) → Future< void> - Ensures the Hylid Bridge is initialized before use.
-
getAuthCode(
{required List< String> scopes, void success(AuthCodeResult result)?, void fail()?, void complete()?}) → Future<void> - Requests an authorization code with the specified scopes.
-
tradePay(
{String? paymentUrl, void success(TradePayResult result)?, void fail(TradePayResult result)?, void complete(TradePayResult result)?}) → Future< void> - Initiates a payment transaction using Hylid's trade pay system.