easy_utils 0.0.6 copy "easy_utils: ^0.0.6" to clipboard
easy_utils: ^0.0.6 copied to clipboard

Some utilities to make your Flutter experience easier and better.

Easy_Utils #

A Flutter package which contains some helpful tools.

Just run flutter pub add easy_utils to add in your project.

Features #

  • Send HTTP requests simply (uses http library as dependency).
  • Manage the app navigation without context requirement.
  • Some string extensions to make your development better.
  • Check the current platform even you're compiling the same code for the Web platform.

EasyNav #

First steps #

MaterialApp

Add EasyNav.navigatorKey and EasyNav.materialAppKey to your MaterialApp instance.

  ...

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      key: EasyNav.materialAppKey,
      navigatorKey: EasyNav.navigatorKey,

  ...
copied to clipboard

CupertinoApp

Add EasyNav.navigatorKey and EasyNav.cupertinoAppKey to your CupertinoApp instance.

  ...

  @override
  Widget build(BuildContext context) {
    return CupertinoApp(
      key: EasyNav.cupertinoAppKey,
      navigatorKey: EasyNav.navigatorKey,

  ...
copied to clipboard

Usage #

Example: Push a new screen

EasyNav.push(const MyScreen());
copied to clipboard

Example: Push a new screen and pop others

EasyNav.replace(const MyScreen());
copied to clipboard

Example: Push a new screen and pop until the first one

EasyNav.replaceUntil(
  const MyScreen(),
  predicate: (route) => route.isFirst,
);
copied to clipboard

Example: Pop all screens until the first one

EasyNav.popUntilFirst();
copied to clipboard

Example: Pop the current screen

EasyNav.pop();
copied to clipboard

For more details, check the src/navigation/nav_utils.dart file.

EasyHttp #

No first step is required, use it directly.

Supported HTTP methods #

  • GET
  • HEAD
  • POST
  • PUT
  • DELETE
  • PATCH

NOTE: You can use another request type with sendCUSTOM method.

Usage #

Example: Send a GET request

EasyHttp.instance.sendGET('https://httpbin.org/get');
copied to clipboard

Example: Define an API prefix and send a GET request

EasyHttp.instance.prefix = 'https://httpbin.org';
EasyHttp.instance.sendGET('/get');
copied to clipboard

Example: Send a custom HTTP request

EasyHttp.instance.sendCUSTOM(
  'https://example.com/myRoute',
  method: 'PROPATCH',
);
copied to clipboard

For more details, check the src/network/http_utils.dart file.

platform_utils #

Check the running OS with a compatible way for the Web platform.

Usage #

Example: Check for the Android OS

...

// import the library
import 'package:easy_utils/platform_utils.dart' as PlatformUtils;

if (PlatformUtils.isAndroid) {
  // it will run when the device have the Android OS
  debugPrint('Hello from Android!');
}

...
copied to clipboard

For more details, check the src/platform folder.

1
likes
0
points
61
downloads

Publisher

verified publisherfurkank.net

Weekly Downloads

2024.09.29 - 2025.04.13

Some utilities to make your Flutter experience easier and better.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, http

More

Packages that depend on easy_utils