twrpbuilder_plugin 1.1.2

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 74

TWRP Builder Plugin

A new Flutter plugin only for Android. This plugin is for TWRPBuilder app only. Although you can use this plugin to get root access in your app.

TO-DO

  • [x] Add method to get root access
  • [x] Add method to create directory
  • [ ] Add method to execute Shell commands

Note

This plugin is WIP.

Getting Started

For help getting started with Flutter, view our online documentation.

For help on editing plugin code, view the documentation.

1.1.1

  • Add Zip compression method

example/lib/main.dart

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

import 'package:twrpbuilder_plugin/twrpbuilder_plugin.dart';

void main() => runApp(new MyApp());

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

class _MyAppState extends State<MyApp> {
  bool _rootAccess = false;
  String dirStatus = "";
  String _brand = "";
  String _board = "";
  String _abi = "";
  String _fingerPrint= "";
  String _model = "'";
  String _product = "";

  @override
  void initState() {
    super.initState();
    initRootRequest();
    _loadDeviceDetails();
  }

  Future<void> initRootRequest() async {
    bool rootAccess = await TwrpbuilderPlugin.rootAccess;

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setState(() {
      _rootAccess = rootAccess;
    });
  }

  Future<void> _createDir() async {
    if(_rootAccess){
      ///Please grant storage permissions in Settings
      //_showLoading();

      String propData = await TwrpbuilderPlugin.buildProp;

      await TwrpbuilderPlugin.createBuildProp('build.prop', propData);

      dirStatus = await TwrpbuilderPlugin.mkDir('TWRPBuilderF');

      //await TwrpbuilderPlugin.cp('/system/build.prop', 'TWRPBuilderF/build.prop');
      bool isOldMtk = await TwrpbuilderPlugin.isOldMtk;
      String recoveryMount = await TwrpbuilderPlugin.getRecoveryMount();
      print(isOldMtk);
      print(recoveryMount);
      //Navigator.of(context).pop(); ///Dismiss Loading dialog

    }
  }

  Future<Null> _showLoading() async {
    return showDialog<Null>(
        context: context,
        barrierDismissible: false,
        builder: (BuildContext context) {
          return AlertDialog(
              content: Container(
                height: 60.0,
                width: 60.0,
                alignment: Alignment.centerLeft,
                child: Row(
                  children: <Widget>[
                    CircularProgressIndicator(),
                    Padding(padding: EdgeInsets.only(left: 8.0, right: 8.0)),
                    Text('Please wait...')
                  ],
                ),
              )
          );
        });
  }

  Future<Null> _loadDeviceDetails() async {
    //_showLoading();
    String brand = await TwrpbuilderPlugin.getBuildBrand;
    String board = await TwrpbuilderPlugin.getBuildBoard;
    String abi = await TwrpbuilderPlugin.getBuildAbi;
    String fingerPrint = await TwrpbuilderPlugin.getBuildFingerprint;
    String model = await TwrpbuilderPlugin.getBuildModel;
    String product = await TwrpbuilderPlugin.getBuildProduct;

    setState(() {
      _brand = brand;
      _board = board;
      _abi = abi;
      _fingerPrint = fingerPrint;
      _model = model;
      _product = product;
      //Navigator.of(context).pop();
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: new Scaffold(
          appBar: AppBar(
            title: Text('Bull'),
          ),
          body: Container(
            padding: EdgeInsets.all(16.0),
            height: 480.0,
            width: 320.0,
            child: Column(
              mainAxisAlignment: MainAxisAlignment.start,
              crossAxisAlignment: CrossAxisAlignment.start,
              mainAxisSize: MainAxisSize.max,
              children: <Widget>[
                ListTile(
                  title: Text('Brand', style: TextStyle(
                      fontSize: 16.0, fontWeight: FontWeight.w700)),
                  subtitle: Text(_brand, style: TextStyle(
                      fontSize: 16.0, fontWeight: FontWeight.w600)),
                ),
                ListTile(
                  title: Text('Board', style: TextStyle(
                      fontSize: 16.0, fontWeight: FontWeight.w700)),
                  subtitle: Text(_board, style: TextStyle(
                      fontSize: 16.0, fontWeight: FontWeight.w600)),
                ),
                ListTile(
                  title: Text('Model', style: TextStyle(
                      fontSize: 16.0, fontWeight: FontWeight.w700)),
                  subtitle: Text(_model, style: TextStyle(
                      fontSize: 16.0, fontWeight: FontWeight.w600)),
                ),
                ListTile(
                  title: Text('Product', style: TextStyle(
                      fontSize: 16.0, fontWeight: FontWeight.w700)),
                  subtitle: Text(_product, style: TextStyle(
                      fontSize: 16.0, fontWeight: FontWeight.w600)),
                ),
                Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: <Widget>[
                    MaterialButton(
                      onPressed: _createDir,
                      color: Colors.blue,
                      child: Text('Backup'),
                    ),
                  ],
                ),
              ],
            ),
          )
      ));
  }

}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  twrpbuilder_plugin: ^1.1.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:twrpbuilder_plugin/twrpbuilder_plugin.dart';
  
Version Uploaded Documentation Archive
1.1.2 Aug 21, 2018 Go to the documentation of twrpbuilder_plugin 1.1.2 Download twrpbuilder_plugin 1.1.2 archive
1.1.1 Aug 21, 2018 Go to the documentation of twrpbuilder_plugin 1.1.1 Download twrpbuilder_plugin 1.1.1 archive
1.1.0 Aug 20, 2018 Go to the documentation of twrpbuilder_plugin 1.1.0 Download twrpbuilder_plugin 1.1.0 archive
1.0.9 Aug 20, 2018 Go to the documentation of twrpbuilder_plugin 1.0.9 Download twrpbuilder_plugin 1.0.9 archive
1.0.8 Aug 20, 2018 Go to the documentation of twrpbuilder_plugin 1.0.8 Download twrpbuilder_plugin 1.0.8 archive
1.0.7 Aug 20, 2018 Go to the documentation of twrpbuilder_plugin 1.0.7 Download twrpbuilder_plugin 1.0.7 archive
1.0.6 Aug 20, 2018 Go to the documentation of twrpbuilder_plugin 1.0.6 Download twrpbuilder_plugin 1.0.6 archive
1.0.5 Aug 20, 2018 Go to the documentation of twrpbuilder_plugin 1.0.5 Download twrpbuilder_plugin 1.0.5 archive
1.0.4 Aug 20, 2018 Go to the documentation of twrpbuilder_plugin 1.0.4 Download twrpbuilder_plugin 1.0.4 archive
1.0.3 Aug 19, 2018 Go to the documentation of twrpbuilder_plugin 1.0.3 Download twrpbuilder_plugin 1.0.3 archive

All 16 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
50
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
74
Learn more about scoring.

We analyzed this package on Aug 21, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.11.8
  • Flutter: 0.5.7

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Suggestions

Format lib/twrpbuilder_plugin.dart.

Run flutter format to format lib/twrpbuilder_plugin.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.58.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.6 1.14.11
meta 1.1.5 1.1.6
sky_engine 0.0.99
typed_data 1.1.5 1.1.6
vector_math 2.0.6 2.0.8
Dev dependencies
flutter_test