flutter_push_client 1.0.1 copy "flutter_push_client: ^1.0.1" to clipboard
flutter_push_client: ^1.0.1 copied to clipboard

Flutter client library for ReactPush update system. Allows Flutter apps to check for and download remote bundle updates.

FlutterPush Client #

Flutter client library for ReactPush update system. This library allows Flutter apps to check for and download remote bundle updates.

Installation #

Add this to your pubspec.yaml:

dependencies:
  flutter_push_client:
    path: ../client_flutter

Or if published to pub.dev:

dependencies:
  flutter_push_client: ^1.0.0

Then run:

flutter pub get

Usage #

Basic Setup #

import 'package:flutter_push_client/flutter_push_client.dart';

final flutterPush = FlutterPush(
  apiKey: 'YOUR_APP_API_KEY',
  apiUrl: 'https://your-api-url.com',
  appVersion: '1.0.0', // Required: Your app version
  userId: 'optional-user-id', // Optional
  onUpdateAvailable: (update) {
    print('Update available: ${update['version']}');
  },
  onUpdateDownloaded: (update) {
    print('Update downloaded: ${update['version']}');
  },
  onError: (error) {
    print('FlutterPush error: $error');
  },
);

// Check for updates
await flutterPush.checkForUpdate();

// Or sync automatically
await flutterPush.sync(
  checkFrequency: 'ON_APP_START',
  installMode: 'ON_NEXT_RESTART',
);

API #

checkForUpdate()

Checks for available updates from the server.

downloadUpdate(update)

Downloads the update bundle and assets.

sync(options)

Automatically checks for updates and downloads them based on the provided options.

Options:

  • checkFrequency: 'ON_APP_START' | 'ON_APP_RESUME' | 'MANUAL'
  • installMode: 'IMMEDIATE' | 'ON_NEXT_RESTART' | 'ON_NEXT_RESUME'

getDownloadedBundleURL()

Returns the local file path of the downloaded bundle, or null if no bundle is downloaded. This can be used by native code to load the bundle.

final bundlePath = await flutterPush.getDownloadedBundleURL();
if (bundlePath != null) {
  print('Downloaded bundle path: $bundlePath');
}

getBundleManager()

Returns the bundle manager instance for advanced usage.

Crash Reporting #

FlutterPush includes built-in crash reporting:

// Report a JavaScript error
await flutterPush.reportJavaScriptError(error, {
  'context': 'myFeature',
});

// Report a custom error
await flutterPush.reportCustomError(
  'Something went wrong',
  'CustomError',
  stackTrace,
  {'userId': '123'},
);

// Add breadcrumbs
flutterPush.addBreadcrumb('User clicked button', {
  'buttonId': 'submit',
});

License #

MIT

0
likes
145
points
28
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Flutter client library for ReactPush update system. Allows Flutter apps to check for and download remote bundle updates.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

archive, asn1lib, crypto, device_info_plus, flutter, http, package_info_plus, path, path_provider, pointycastle, shared_preferences, uuid

More

Packages that depend on flutter_push_client