auto_start_flutter 0.0.2 copy "auto_start_flutter: ^0.0.2" to clipboard
auto_start_flutter: ^0.0.2 copied to clipboard

outdated

The plugin redirects the user to auto-start permission screen to allow auto-start and fix background problems in some phones.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:auto_start_flutter/auto_start_flutter.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
    //call in init state;
    initAutoStart();
  }

  //initializing the autoStart with the first build.
  Future<void> initAutoStart() async {
    try {
      //check auto-start availability.
      var test = await AutoStartFlutter.isAutoStartAvailable;
      print(test);
      //if available then navigate to auto-start setting page.
      if (test) await AutoStartFlutter.getAutoStartPermission();
    } on PlatformException catch (e) {
      print(e);
    }
    if (!mounted) return;
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Auto Start Flutter Example'),
        ),
        body: Center(
          child: Text("Auto Start initialize..."),
        ),
      ),
    );
  }
}
46
likes
0
pub points
90%
popularity

Publisher

verified publishertechflow.ir

The plugin redirects the user to auto-start permission screen to allow auto-start and fix background problems in some phones.

Homepage

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on auto_start_flutter