palestine_first_run 0.0.14 copy "palestine_first_run: ^0.0.14" to clipboard
palestine_first_run: ^0.0.14 copied to clipboard

Lightweight and easy check if the app runs for its first time, apply that to custom calls.

example/lib/main.dart

import 'dart:developer' as developer;

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

void main() {
  // Make Sure Framework Is Ready
  WidgetsFlutterBinding.ensureInitialized();

  runApp(const MyApp());
}

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

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

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
    Future.delayed(Duration.zero, () async {
      final bool isFirstRun = await PalFirstRun.isFirstRun();
      developer.log(isFirstRun.toString());

      final bool isFirstAPICall = await PalFirstRun.isFirstRun('call_api');
      developer.log(isFirstAPICall.toString());
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: const Center(
          child: Text('Running on'),
        ),
      ),
    );
  }
}
30
likes
130
pub points
65%
popularity

Publisher

verified publishermsayed.net

Lightweight and easy check if the app runs for its first time, apply that to custom calls.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter, shared_preferences

More

Packages that depend on palestine_first_run