publishable 0.0.10 copy "publishable: ^0.0.10" to clipboard
publishable: ^0.0.10 copied to clipboard

Flutter-specific, opinionated, and convient package for implementing Publishable in your app.

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.
0
likes
130
points
54
downloads

Publisher

verified publisherpublishable.app

Weekly Downloads

Flutter-specific, opinionated, and convient package for implementing Publishable in your app.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

device_info_plus, flutter, http, intl, logging, package_info_plus, publishable_core, shared_preferences, uuid

More

Packages that depend on publishable