request_api_helper 4.0.5+3 copy "request_api_helper: ^4.0.5+3" to clipboard
request_api_helper: ^4.0.5+3 copied to clipboard

send request with stack request management and cancel request.

example/lib/main.dart

import 'package:example/splash.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:request_api_helper/loading.dart';
import 'package:request_api_helper/request.dart';
import 'package:request_api_helper/request_api_helper.dart';

void main() async {
  // in main.dart after WidgetsFlutterBinding.ensureInitialized()
  WidgetsFlutterBinding.ensureInitialized();
  await RequestApiHelper.init(
    RequestApiHelperData(
      baseUrl: '',
      debug: true,
    ),
    encryptedSession: true,
    useMultiThread: true,
  );
  Loading.widget = (context) async {
    await showDialog(
      barrierColor: Colors.black12,
      context: context,
      builder: (context) {
        Loading.currentContext = context;
        Loading.lastContext = context;
        return const Material(
          child: Center(
            child: Text('Loading'),
          ),
        );
      },
    );
    Loading.loading = false;
    Loading.currentContext = context;
  };

  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    final textTheme = Theme.of(context).textTheme;
    return RequestApiHelperApp(
      title: 'Request Api Helper',
      theme: ThemeData(
        brightness: Brightness.dark,
        primarySwatch: Colors.blue,
        textTheme: GoogleFonts.latoTextTheme(textTheme).copyWith(
          bodyText2: GoogleFonts.karla(textStyle: textTheme.bodyText2).apply(color: Colors.white),
        ),
      ),
      home: const StartView(),
    );
  }
}
6
likes
0
pub points
26%
popularity

Publisher

unverified uploader

send request with stack request management and cancel request.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

encrypt, flutter, http, http_parser, sqflite

More

Packages that depend on request_api_helper