lib_mvp 1.0.0

  • Readme
  • Changelog
  • Installing
  • 40

lib_mvp #

an achieve of mvp framework,

Thanks #

Thanks to the simplezhli -> flutter deer project, this library is an MVP implementation separated from this project.

This is a strongly coupled tool library with the following open source libraries built in:

  1. dio: ^2.1.13
  2. sprintf: ^4.0.0
  3. rxdart: ^0.21.0
  4. oktoast: ^2.1.8

Getting Started #

一、 init OKToast: #

  Widget build(BuildContext context) {
    return OKToast(//init OKToast
      child: MaterialApp(
        title: 'MVP Framework Test',
        theme: ThemeData(
        home: IndexPage(),

二、xxxPageState extends BasePageState ,Take IndexPage as an example #

class IndexPage extends StatefulWidget {
  State<StatefulWidget> createState() {
    return IndexPageState();

class IndexPageState extends BasePageState<IndexPage, IndexPagePresenter> {

  IndexPagePresenter createPresenter() {
    return IndexPagePresenter();


三、Create xxxPagePresenter,Take IndexPagePresenter as an example #

class IndexPagePresenter extends BasePagePresenter<IndexPageState>{

  void requestUserInfo(){
      url: Api.users,
      baseUrl: Api.baseUrl,
      onSuccess: (response){
        Map<String,dynamic> _map = json.decode(response?.data.toString());
        String result = json.encode(_map);
        ResponseUserInfoEntity entity = EntityFactory.generateOBJ(_map["data"]);

Hope you enjoy it!!!!

Here is a sample demo show how to use this mvp framework,scan this qrcode to download android demo.

android demo apk

Or It is especially recommended that you check out this open source project =>simplezhli -> flutter deer

[1.0.0] - 2019-8-23 17:50:09

  • Mvp mode implementation, network request encapsulation

Use this package as a library

1. Depend on it

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

  lib_mvp: ^1.0.0

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:

import 'package:lib_mvp/lib_mvp.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Oct 11, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/network/intercept.dart. (-0.50 points)

Analysis of lib/network/intercept.dart reported 1 hint:

line 10 col 8: Unused import: 'dio_utils.dart'.

Format lib/mvp/base_page_state.dart.

Run flutter format to format lib/mvp/base_page_state.dart.

Format lib/mvp/contract.dart.

Run flutter format to format lib/mvp/contract.dart.

Fix additional 7 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/mvp/ilife_cycle.dart (Run flutter format to format lib/mvp/ilife_cycle.dart.)
  • lib/network/base_entity.dart (Run flutter format to format lib/network/base_entity.dart.)
  • lib/network/error_handler.dart (Run flutter format to format lib/network/error_handler.dart.)
  • lib/router/app_navigator.dart (Run flutter format to format lib/router/app_navigator.dart.)
  • lib/utils/toast_utils.dart (Run flutter format to format lib/utils/toast_utils.dart.)
  • lib/utils/utils.dart (Run flutter format to format lib/utils/utils.dart.)
  • lib/widget/loading_dialog.dart (Run flutter format to format lib/widget/loading_dialog.dart.)

Maintenance issues and suggestions

Support latest dependencies. (-20 points)

The version constraint in pubspec.yaml does not support the latest published versions for 2 dependencies (dio, rxdart).

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and lib_mvp.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
dio ^2.1.13 2.2.2 3.0.3
flutter 0.0.0
oktoast ^2.1.8 2.2.0
rxdart ^0.21.0 0.21.0 0.22.3
sprintf ^4.0.0 4.0.2
Transitive dependencies
collection 1.14.11 1.14.12
cookie_jar 1.0.1
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies