request_api_helper 4.0.1+1 copy "request_api_helper: ^4.0.1+1" to clipboard
request_api_helper: ^4.0.1+1 copied to clipboard

outdated

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_api_helper.dart';

final navigatorKey = GlobalKey<NavigatorState>();
void main() {
  // in main.dart after WidgetsFlutterBinding.ensureInitialized()
  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.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 MaterialApp(
      navigatorKey: navigatorKey,
      navigatorObservers: [RequestApiHelperObserver()],
      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
29%
popularity

Publisher

unverified uploader

send request with stack request management and cancel request.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, fluttertoast, http, http_parser, sqflite, webview_flutter

More

Packages that depend on request_api_helper