go_online 0.0.3 copy "go_online: ^0.0.3" to clipboard
go_online: ^0.0.3 copied to clipboard

outdated

This package provides a GoOnline class that can be used to make HTTP requests to a RESTful API. The class is designed to simplify the process of sending HTTP requests by abstracting away the implement [...]

This package provides a GoOnline class that can be used to make HTTP requests to a RESTful API. The class is designed to simplify the process of sending HTTP requests by abstracting away the implementation details of the http package. The GoOnline class has methods for sending GET, POST, PUT, and DELETE requests to an API.

Features #

This package can be used to send HTTP requests to a RESTful API. Specifically, it provides methods for sending GET, POST, PUT, and DELETE requests to an API, along with the necessary headers for each request. It also includes a method for retrieving an authentication token from the device's SharedPreferences.

The GoOnline class can be instantiated with a base URL for the API, and the postData(), getData(), updateData(), and deleteData() methods can be used to send requests to the API with the provided data. The responses from the API can be handled using the http package's built-in response handling functions.

Getting started #

import the package

Usage #

import 'package:flutter/material.dart';
import 'package:your_package_name/go_online.dart';

class MyWidget extends StatelessWidget {
final api = GoOnline();

@override
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: () async {
final data = {'name': 'John', 'email': 'john@example.com'};
final response = await api.postData(data, 'users');
print(response.body);
},
child: Text('Send Request'),
);
}
}
 var goOnline = GoOnline();
String baseURL='https://www.google.com';
var tokenKey='tufufyufygjhyjgyjfyjfyfyfyjgygyi';
goOnline.token=tokenKey;
goOnline.baseurl=baseURL;
var fetch = await goOnline.getData('/search?q=Rarible');
print(fetch.body);
var data = {'name': 'John', 'email': 'john@example.com'};
var response = await goOnline.postData(data, 'users');
var fetch = await goOnline.getData('demo.com/api');
print(fetch.body);

print(response.body);


var responseUpdate = await goOnline.updateData(data, 'users/1');
print(responseUpdate.body);

var responseDelete = await goOnline.deleteData('users/1');
print(responseDelete.body);

Additional information #

Visit Flutter.dev

5
likes
0
points
43
downloads

Publisher

verified publisherobunnovation.com

Weekly Downloads

This package provides a GoOnline class that can be used to make HTTP requests to a RESTful API. The class is designed to simplify the process of sending HTTP requests by abstracting away the implementation details of the http package. The GoOnline class has methods for sending GET, POST, PUT, and DELETE requests to an API.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, http, logger, shared_preferences

More

Packages that depend on go_online