instrument_base_model 0.0.4 copy "instrument_base_model: ^0.0.4" to clipboard
instrument_base_model: ^0.0.4 copied to clipboard

仪器信息网 https://www.instrument.com.cn/ 前端Flutter 库

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:instrument_base_model/base_manager.dart';
import 'package:instrument_base_model/https/dio_manager.dart';

import 'model/main_model.dart';
import 'pages/base_page/base_stateful_page.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends BaseStatefulPage {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  BaseStatefulPageState<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends BaseStatefulPageState<MyHomePage>
    with MainModel {
  @override
  void initData() {
    BaseManager.init(
        httpBaseUrl: "https://gateway.woyaoce.cn/app/",
        headerDelegate: (params) {
          // todo 自定义Header全局 规则
          // DioManager.instance.header.addAll(params ?? {});
        });
  }

  @override
  void initHttpData() {}

  @override
  Widget buildPage(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("title"),
      ),
      body: TextButton(
          onPressed: () {
            DioManager.instance.delHeader("kkk");
            loadHome(
                error: (e) {
                  setError(e);
                },
                success: (res) {});
          },
          child: const Text("http")),
    );
  }
}
1
likes
110
pub points
11%
popularity

Publisher

unverified uploader

仪器信息网 https://www.instrument.com.cn/ 前端Flutter 库

Documentation

API reference

License

MIT (license)

Dependencies

connectivity_plus, convert, cookie_jar, crypto, decimal, dio, dio_cookie_manager, flutter, oktoast, rational

More

Packages that depend on instrument_base_model