updater 0.0.9 copy "updater: ^0.0.9" to clipboard
updater: ^0.0.9 copied to clipboard

outdated

A package to check for the custom in-app updates for Flutter.

example/lib/main.dart

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

void main() {
  runApp(const AppMain());
}

class AppMain extends StatelessWidget {
  const AppMain({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: "Test",
      home: MyApp(),
    );
  }
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  UpdaterController controller = UpdaterController(
    listener: (UpdateStatus status) {
      print('Listener: $status');
    },
    onChecked: (bool isAvailable) {
      print(isAvailable);
    },
    progress: (current, total) {
      print('Progress: $current -- $total');
    },
    onError: (status) {
      print('Error: $status');
    },
  );

  @override
  void dispose() {
    controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: TextButton(
            onPressed: () {
              checkUpdate();
            },
            child: const Text('Check For Update'),
          ),
        ),
      ),
    );
  }

  checkUpdate() async {
    bool isAvailable = await Updater(
      context: context,
      delay: const Duration(milliseconds: 300),
      url: 'https://codingwithmarsad.web.app/updater.json',
      titleText: 'Stay with time',
      // backgroundDownload: false,
      // allowSkip: false,
      contentText:
          'Update your app to the latest version to enjoy new feature.',
      // allowSkip: false,
      callBack:
          (versionName, versionCode, contentText, minSupport, downloadUrl) {},
      controller: controller,
    ).check();

    print(isAvailable);
  }
}
39
likes
0
pub points
80%
popularity

Publisher

verified publishermarsad.dev

A package to check for the custom in-app updates for Flutter.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

dio, flutter, http, open_file, package_info_plus, path_provider

More

Packages that depend on updater