linkhive_flutter 1.5.0 copy "linkhive_flutter: ^1.5.0" to clipboard
linkhive_flutter: ^1.5.0 copied to clipboard

A Flutter plugin to connect with LinkHive for dynamic links.

example/lib/main.dart

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

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await LinkHiveClient.instance.connect(
    baseUrl: 'base url',
    projectId: 'your projectId',
    clientId: 'your clientId',
    enableLogging: true,
  );

  print(LinkHiveClient.instance.isConnected);
  var initial = await LinkHiveClient.instance.dynamicLinks.getInitialLink();
  print('initial  $initial');
  LinkHiveClient.instance.dynamicLinks.onLinkReceived.listen((e) {
    print('link clicked  $e');
  });
  runApp(const MyApp());
}

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

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

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('LinkHive Plugin example app')),
      ),
    );
  }
}