lib_mvp 1.0.1

  • 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 #

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

Now in your Dart code, you can use:

import 'package:lib_mvp/lib_mvp.dart';

一、 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

[1.0.01] - 2019-11-13 11:28:09 #

  • Add network request progress

Use this package as a library

1. Depend on it

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

  lib_mvp: ^1.0.1

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 Jul 2, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.9+1
  • Flutter: 1.17.3

Analysis suggestions

Package not compatible with SDK dart

because of import path [lib_mvp]

Package not compatible with runtime flutter-web of web

Because of the import of dart:io via the import chain package:lib_mvp/lib_mvp.dart->package:lib_mvp/network/error_handler.dart->package:dio/dio.dart->package:dio/src/dio_http_headers.dart->dart:io

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.9
flutter 0.0.0
oktoast ^2.1.8 2.3.2
rxdart ^0.21.0 0.21.0 0.24.1
sprintf ^4.0.0 4.0.2
Transitive dependencies
collection 1.14.12 1.14.13
cookie_jar 1.0.1
meta 1.1.8 1.2.0
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8
Dev dependencies