weespin_flutter 1.0.0 copy "weespin_flutter: ^1.0.0" to clipboard
weespin_flutter: ^1.0.0 copied to clipboard

Weespin Flutter plugin. Helps you create deep links in a blink

example/lib/main.dart

import 'dart:async';

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

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

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

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

class _MyAppState extends State<MyApp> {
  String link = '';
  Future<void> createLink() async {
    try {
      final response = await Weespin(
        apiKey: 'YOUR API KEY',
      ).createLink(
        title: "My link",
        description: "Description test",
        segments: ["news", "bananas"],
        customParams: ["utm", "productId"],
      );
      print("✅ Response : $response");

      var shareLink = response.shareLink({"utm": 'android', "productId": '123'});

      print("✅ shareLink : $shareLink");
      setState(() {
        link = response.fullUrl;
      });
    } on WeespinException catch (e) {
      print(e);
      setState(() {
        link = e.message;
      });
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Plugin example app')),
        body: Center(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              ElevatedButton(
                onPressed: createLink,
                child: const Text('Create Link'),
              ),
              const SizedBox(height: 16),
              Padding(
                padding: EdgeInsets.all(8),
                child: Text(
                  link,
                  style: TextStyle(
                    fontSize: 20,
                    color: Colors.blue,
                    decoration: TextDecoration.underline,
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
1
likes
140
points
101
downloads

Publisher

unverified uploader

Weekly Downloads

Weespin Flutter plugin. Helps you create deep links in a blink

Homepage

Topics

#weespin #deeplinks #deep-links #dynamic-links

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on weespin_flutter