GtkApplicationNotifier class

An object that can be used to listen to remote GTK application command-line arguments and file open requests outside the widget tree.

import 'package:flutter/widgets.dart';
import 'package:gtk_application/gtk_application.dart';

void main(List<String> args) {
  WidgetsFlutterBinding.ensureInitialized();

  final notifier = GtkApplicationNotifier(args);
  notifier.addCommandLineListener((args) {
    print('command-line: $args');
  });
  notifier.addOpenListener((files, hint) {
    print('open ($hint): $files');
  });

  // ...
  // notifier.dispose();
}

See also:

Constructors

GtkApplicationNotifier([List<String>? _commandLine])
Creates a new GtkApplicationNotifier. Optionally, the initial value of commandLine can be provided.

Properties

commandLine List<String>?
Returns the most recent command-line arguments.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addCommandLineListener(GtkCommandLineListener listener) → void
Adds a listener that will be notified when the application receives remote command-line arguments.
addOpenListener(GtkOpenListener listener) → void
Adds a listener that will be notified when the application receives remote file open requests.
dispose() → void
Discards any resources used by the object. After this is called, the listeners will no longer be notified.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyCommandLine(List<String> args) → void
Notify all the remote command-line argument listeners.
notifyOpen({required List<String> files, required String hint}) → void
Notify all the remote file open request listeners.
removeCommandLineListener(GtkCommandLineListener listener) → void
Removes a previously registered remote command-line argument listener.
removeOpenListener(GtkOpenListener listener) → void
Removes a previously registered remote file open request listener.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited