Skip to content
pubscout

qs_dart

1.9.0, released 7 weeks ago by tusar.dev

A query string encoding and decoding library for Dart ported from JavaScript's qs.

WASM-ready
$ flutter pub add qs_dart
Source repository

What it does

Encodes Dart maps into query strings and decodes query strings into nested maps and lists. It supports advanced features like dot notation, custom delimiters, different list formats, character sets, and safety limits.

AI-written summary of version 1.9.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to encode complex, nested Dart maps into URL query strings.
  • You need to parse complex query strings with nested brackets or dot notation into maps.
  • You want parity with the JavaScript 'qs' library for API interoperability.

Skip it when

  • You only need basic, flat query parameter manipulation covered by Dart's built-in Uri class.

Strengths

  • Supports deeply nested maps and lists using bracket or dot notation.
  • Highly configurable options for charset encoding, duplicate handling, and depth limits.
  • Provides convenient Uri extensions for idiomatic Dart usage.

Weaknesses

  • Adds an external dependency overhead for functionality partially handled by core libraries if query strings are completely flat.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
3
import 'package:qs_dart/qs_dart.dart';
import 'package:test/test.dart';

void main() {
  test('Simple example', () {
    expect(
      QS.decode('a=c'),
      equals({'a': 'c'}),
    );

    expect(
      QS.encode({'a': 'c'}),
      equals('a=c'),
    );
  });
}

Alternatives

Packages that do the same job and could replace qs_dart.

Works with

Packages commonly used together with qs_dart: ones it builds on, ones built on it, and its own family.