toQuery static method

String toQuery(
  1. Object model
)

Implementation

static String toQuery(Object model) {
  final json = jsonEncode(model);
  final map = jsonDecode(json) as Map<String, dynamic>;

  final pairs = map.entries
      .where((e) => e.value != null)
      .map((e) => '${e.key}=${Uri.encodeComponent(e.value.toString())}')
      .join('&');

  return pairs;
}