publishable

Package Publisher MIT License Publishable Lints

publishable is a Flutter-specific package that allows you to send data from your project directly to the Publishable console.

Status Comments
Tests (stable) Current stable Flutter version
Tests (beta) Current beta Flutter version
Tests (3.32.0) The oldest supported Flutter version

Getting started

  1. Add this package to your dependencies.
dependencies:
  publishable: latest_version
  1. Get the dependencies.
flutter pub get
  1. Create a new instance with your API key.
final publishable = await PublishableFlutter.create(
  // TODO: Replace with your token.
  token: 'xxxx-xxxx-xxxx-xxxx',
  // You can replace it with your own implementation if you have a custom configuration.
  fromJson: PublishableConfiguration.fromJson,
  fallback: PublishableConfiguration.fallback,
);
  1. Wrap your app in FlutterPublishable.
runApp(
  PublishableFlutter(
    instance: publishable,
    child: const MaterialApp(
      // Rest of the app...
    ),
  ),
);

Example

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

Future<void> main() async {
  final publishable = await PublishableFlutter.create(
    // TODO: Replace with your token.
    'xxxx-xxxx-xxxx-xxxx',
  );

  runApp(
    PublishableFlutter(
      instance: publishable,
      child: const MaterialApp(
        home: Scaffold(
          body: Center(
            child: _Button(),
          ),
        ),
      ),
    ),
  );
}

class _Button extends StatelessWidget {
  const _Button();

  @override
  Widget build(BuildContext context) {
    final publishable = PublishableFlutter.of(context);

    return ElevatedButton(
      onPressed: () => publishable.sendFeedback('Test!'),
      child: const Text('Send Feedback'),
    );
  }
}

Usage with other packages

import 'package:feedback/feedback.dart';
import 'package:flutter/material.dart';
import 'package:publishable/publishable.dart';

class _Button extends StatelessWidget {
  const _Button();

  @override
  Widget build(BuildContext context) {
    final publishable = PublishableFlutter.of(context);
    final feedback = BetterFeedback.of(context);

    return ElevatedButton(
      onPressed: () => feedback.show(
        (feedback) => publishable.sendFeedback(
          feedback.text,
          attachment: feedback.screenshot,
          properties: feedback.extra ?? const {},
        ),
      ),
      child: const Text('Send Feedback'),
    );
  }
}

Advanced users

For advanced users there is a package called package:publishable_core that may better suit your needs. It doesn't include most of the dependencies that publishable contains, so you can use packages of your choice.

Additional information

  • This package requires at least Flutter 3.32 and Dart 3.8 to work.
  • If there are any issues feel free to go to GitHub Issues and report a bug.

Libraries

mapper
publishable