Skip to main content

vela_links 0.1.1 copy "vela_links: ^0.1.1" to clipboard
vela_links: ^0.1.1 copied to clipboard

Deep links, app links, deferred deep links, short links, share links, QR codes and link tracking for Flutter. A Firebase Dynamic Links alternative.

example/lib/main.dart

import 'dart:async';

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

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  // Replace with the SDK key from your Vela Links dashboard.
  await VelaLinks.init(
      apiKey: 'vl_your_sdk_key', baseUrl: 'https://api.links.velaapps.in');
  runApp(const ExampleApp());
}

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

  @override
  State<ExampleApp> createState() => _ExampleAppState();
}

class _ExampleAppState extends State<ExampleApp> {
  VelaLink? _last;
  StreamSubscription<VelaLink>? _subscription;

  @override
  void initState() {
    super.initState();
    _last = VelaLinks.instance.consumePendingLink();
    _subscription = VelaLinks.instance.onLink
        .listen((link) => setState(() => _last = link));
  }

  @override
  void dispose() {
    _subscription?.cancel();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Vela Links example')),
        body: Center(
            child: Text(_last == null
                ? 'Open a link to see it here'
                : 'Opened ${_last!.route} ${_last!.params}')),
      ),
    );
  }
}
2
likes
0
points
274
downloads

Publisher

verified publishervelaapps.in

Weekly Downloads

Deep links, app links, deferred deep links, short links, share links, QR codes and link tracking for Flutter. A Firebase Dynamic Links alternative.

Homepage
View/report issues

Topics

#deep-links #app-links #deferred-deep-links #link-tracking #qr-code

License

unknown (license)

Dependencies

app_links, flutter, http, package_info_plus, play_install_referrer, shared_preferences

More

Packages that depend on vela_links