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

A browser like http client for flutter application.

Magator Logo

VAJRA

A HTTP Client Library Written In DartπŸ‘©πŸ½β€πŸ’»
Made with ❀️  by developers for developers

A browser like HTTP Client library for flutter applications. It supports automatic cookie saving and attaching, supports automatic attachement of authorization token.

Usage #

TO use this package, add vajra as a dependency in your pubspec.yaml file.

Example #

// Initilize Vajra class in main function and use it anywhere in your app.
void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  Directory directory = await getApplicationDocumentsDirectory();

  // Initializing Vajra class
  Vajra client = Vajra(directory.path, basePath: "http://10.0.2.2:8000");
  await client.initialize();
  client.setDefaultAuthorization(SecurityScheme.bearer, "body", "token");

  runApp(MyApp(directory.path));
}

.
.
.
// access the vajra client anywhere in your application.
Vajra vajraClient = getVajra();
final VajraResponse vajraResponse = await client.get(
  "/testget",
  secured: true,
  sendCookie: true,
  expectAuthorization: true,
  headers: {"service": "vajra"}
);
print(vajraResponse.body);
.
.
.

Features #

Use this package in your Flutter app to:

  • To automatically save and attach cookies to and from request and response respectively.
  • You can also switch off automatic attaching of cookies in request.
  • Automatically save and attach authorization scheme/token.
  • Initialize once and use it anywhere in your flutter app.
0
likes
130
pub points
0%
popularity

Publisher

unverified uploader

A browser like http client for flutter application.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, get_it, hive_flutter, http, path_provider

More

Packages that depend on vajra