response_x 1.0.1 copy "response_x: ^1.0.1" to clipboard
response_x: ^1.0.1 copied to clipboard

library for exchanging response between server and client. it can be a useful tool for standardizing the way that a server communicates with its clients.

example/response_x_example.dart

import 'package:response_x/response_x.dart';

void main() {
  final codes = <int>[200, 201, 202, 203, 204, 205, 206, 207, 208, 226];
  for (var code in codes) {
    final response = Response.status(code);
    final json = response.json({
      'message': 'this is a $code code response',
    });
    print(json);
  }
  final errorCodes = <int>[
    400,
    401,
    402,
    403,
    404,
    405,
    406,
    407,
    408,
    409,
    500,
    501,
    502,
    503,
    504,
    505
  ];

  for (var code in errorCodes) {
    final response = Response.status(code);
    final json = response.json({
      'message': 'this is a $code code response',
    });
    print('\x1B[31m$json\x1B[0m');
  }
}
7
likes
160
pub points
10%
popularity

Publisher

verified publisherbetterx.io

library for exchanging response between server and client. it can be a useful tool for standardizing the way that a server communicates with its clients.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

equatable

More

Packages that depend on response_x