deeplynks 3.0.0 copy "deeplynks: ^3.0.0" to clipboard
deeplynks: ^3.0.0 copied to clipboard

discontinuedreplaced by: urlynk_flutter

DeepLynks (now URLynk) is a Flutter package for deep linking. It opens the app directly if it's installed, or redirects to the store for download if not, preserving the link context through installation.

example/main.dart

import 'dart:convert';
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:deeplynks/deeplynks.dart';

void main() => runApp(const MyApp());

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

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

class _MyAppState extends State<MyApp> {
  final _deeplynks = Deeplynks();

  @override
  void initState() {
    super.initState();
    WidgetsBinding.instance.addPostFrameCallback((_) => _init());
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Builder(
        builder: (context) {
          return Scaffold(
            appBar: AppBar(title: const Text('Deeplynks Demo')),
            body: Center(
              child: ElevatedButton(
                onPressed: _createLink,
                child: const Text('Refer'),
              ),
            ),
          );
        },
      ),
    );
  }

  /// Initialize deeplynks & listen for link data
  Future<void> _init() async {
    final appId = await _deeplynks.init(
      context: context,
      metaData: MetaInfo(name: 'Deeplynks Demo'),
      androidInfo: AndroidInfo(
        sha256: [],
        applicationId: 'com.example.deeplynks',
      ),
      iosInfo: IOSInfo(
        teamId: '',
        appStoreURL: '',
        bundleId: 'com.example.deeplynks',
      ),
    );

    // Use this appId for Android platform setup
    log('Deeplynks App Id: $appId');

    // Listen for link data
    _deeplynks.stream.listen((data) {
      // Handle link data
      log('Deeplynks Data: $data');
    });
  }

  /// Create a new deep link
  Future<void> _createLink() async {
    final link = await _deeplynks.createLink(
      jsonEncode({'referredBy': '12345', 'referralCode': 'WELCOME50'}),
    );
    log('Deeplynks Link: ${link?.customLink ?? link?.defaultLink}');
  }
}
13
likes
150
points
62
downloads

Publisher

verified publishervalueoutput.com

Weekly Downloads

DeepLynks (now URLynk) is a Flutter package for deep linking. It opens the app directly if it's installed, or redirects to the store for download if not, preserving the link context through installation.

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, http

More

Packages that depend on deeplynks