gtk
2.2.0, released 7 months ago by canonical.com
GTK utilities for Flutter Linux applications, providing settings and application lifecycle helpers.
What it does
The package offers a GtkSettings wrapper to access GSettings and a GtkApplication widget/notifier to listen to remote command‑line arguments and file‑open requests. It also includes a GtkIcon wrapper for GTK icons.
AI-written summary of version 2.2.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You are building a Flutter app for Linux and need to integrate with native GTK settings or handle remote command‑line/file‑open events.
- You want a mockable GSettings API for testing on Linux.
Skip it when
- Your app targets non‑Linux platforms (Android, iOS, web, Windows, macOS).
- You need visual GTK widgets rather than non‑visual utilities.
Strengths
- Direct integration with native GTK APIs.
- Simple Dart API for settings and application events.
- Mockable GSettings for unit tests.
Weaknesses
- Linux‑only; no support for other platforms.
- Requires manual changes to linux/my_application.cc, increasing setup complexity.
- Limited to non‑visual utilities; no UI components.
Setup
- Kind
- Plugin (native code)
- Effort
- High
- Code generation
- No
- Direct dependencies
- 2
Edit linux/my_application.cc as described: modify activate, local_command_line, and my_application_new functions to use G_APPLICATION_HANDLES_COMMAND_LINE | G_APPLICATION_HANDLES_OPEN and present existing windows.
import 'package:flutter/material.dart';
import 'package:gtk_application/gtk_application.dart';
void main() {
runApp(MaterialApp(
home: GtkApplication(
onCommandLine: (args) => print('command-line: $args'),
onOpen: (files, hint) => print('open ($hint): $files'),
child: const Scaffold(body: Center(child: Text('Hello'))),
),
));
}Alternatives
Packages that do the same job and could replace gtk.
- mime
Utilities to resolve MIME types from file names, magic bytes, and to parse multipart streams.
92Compare - stream_transform
Extension methods adding common stream transform operators
91Compare - io
Utilities for the Dart VM Runtime including ANSI colors, file copying, and exit code values.
88Compare - extension_discovery
Convention and utilities for discovering package extensions via config.yaml files.
86Compare
Works with
Packages commonly used together with gtk: ones it builds on, ones built on it, and its own family.