softlink_flutter 0.0.7 copy "softlink_flutter: ^0.0.7" to clipboard
softlink_flutter: ^0.0.7 copied to clipboard

SoftLink Flutter SDK for deep linking, deferred deep linking, and install attribution.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:softlink_flutter/softlink_flutter.dart';

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

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

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

class _MyAppState extends State<MyApp> {
  String _screen = 'None';
  Map<String, dynamic> _params = {};

  @override
  void initState() {
    super.initState();
    SoftLink.init(
      baseUrl: 'https://api-link.supersoft.com.pk',
      apiKey: 'sl_your_api_key_here',
      onDeepLink: (deepLink) {
        if (deepLink == null) return;
        setState(() {
          _screen = deepLink.screen;
          _params = deepLink.params;
        });
      },
    );
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'SoftLink Example',
      home: Scaffold(
        appBar: AppBar(title: const Text('SoftLink Example')),
        body: Padding(
          padding: const EdgeInsets.all(16),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text('Screen: $_screen', style: const TextStyle(fontSize: 18)),
              const SizedBox(height: 8),
              Text('Params: $_params', style: const TextStyle(fontSize: 14)),
              const SizedBox(height: 24),
              ElevatedButton(
                onPressed: () async {
                  final url = await SoftLink.generateReferralLink(
                    screenKey: 'PRODUCT_DETAIL',
                    values: {'productCode': '207'},
                    referrerId: 'USER_123',
                  );
                  if (url != null) {
                    debugPrint('Generated link: $url');
                  }
                },
                child: const Text('Generate Referral Link'),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
2
likes
0
points
740
downloads

Publisher

verified publishersupersoft.com.pk

Weekly Downloads

SoftLink Flutter SDK for deep linking, deferred deep linking, and install attribution.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

app_links, device_info_plus, flutter, get_storage, http

More

Packages that depend on softlink_flutter

Packages that implement softlink_flutter