static_shortcuts 0.0.2 copy "static_shortcuts: ^0.0.2" to clipboard
static_shortcuts: ^0.0.2 copied to clipboard

PlatformAndroid

Generate and handle static shortcuts for Android and access the intent in one line of dart code.

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:static_shortcuts/static_shortcuts.dart';

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

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

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

class _MyAppState extends State<MyApp> {
  String _shortcutIntent = 'Unknown';

  @override
  void initState() {
    super.initState();
    queryShortcutIntent();
  }

  Future<void> queryShortcutIntent() async {
    String? shortcutIntent = await StaticShortcuts.getShortcutIntentUri();

    // Do your routing based on the shortcutIntent here.

    setState(() {
      _shortcutIntent = shortcutIntent ?? "Started without shortcut.";
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('static_shortcuts example app')),
        body: Center(child: Text('Shortcut Intent: $_shortcutIntent\n')),
      ),
    );
  }
}
1
likes
150
points
7
downloads

Publisher

unverified uploader

Weekly Downloads

Generate and handle static shortcuts for Android and access the intent in one line of dart code.

Homepage

Documentation

API reference

License

BSD-2-Clause (license)

Dependencies

flutter, image, path, path_provider, plugin_platform_interface, xml, yaml

More

Packages that depend on static_shortcuts

Packages that implement static_shortcuts