tang_network 0.0.8 copy "tang_network: ^0.0.8" to clipboard
tang_network: ^0.0.8 copied to clipboard

The util of HTTP Network implements on the Flutter platform.

tang_network #

The util of HTTP Networking with the capabilities:

  • Get
  • Post
  • Upload
  • Download
  • abstract configuration supported

Installation #

dependencies:
  tang_network: ^0.0.1

Usage #

Setup

  • Implementing the configurations for your project,
/// Configuration.
class MainConfigNetworkHttp implements NetworkHttpConfig { ... }
/// Base.
class MainConfigNetworkHttpBase implements NetworkHttpBase { ... }
/// Keys.
class MainConfigNetworkHttpKeys implements NetworkHttpKeys { ... }
/// Codes.
class MainConfigNetworkHttpCodes implements NetworkHttpCodes { ... }
/// Getters.
class MainConfigNetworkHttpGetters implements NetworkHttpGetters { ... }
/// Callbacks.
class MainConfigNetworkHttpCallbacks implements NetworkHttpCallbacks { ... }
  • Invoking the setup() method before the root page displaying,
await NetworkHttp.shared.setup(config: MainConfigNetworkHttp());
  • Optional step, invoking the setupDeviceInfo() method after user has granted the permission of Device Info, if you do not invoke this method, the Device Info will be passively initialized when the NetworkHttp.shared.request() method is called for the first time.
onPrivacyPolicyConfirmed: () async {
  await NetworkHttp.shared.setupDeviceInfo();
}

Request

  • Creating your own API class and call the NetworkHttp's APIs to send the request,
final response = await NetworkHttp.shared.request('/api-service/module/method',
  {
    'param1': 1,
    'param2': '2',
  },
  method: NetworkMethodType.post,
).then((resp) => NetworkRespModel.fromJson(resp));
return response;
1
likes
150
points
97
downloads

Publisher

verified publisheryltang.com.cn

Weekly Downloads

The util of HTTP Network implements on the Flutter platform.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

crypto, dio, encrypt, flutter, pretty_dio_logger

More

Packages that depend on tang_network