diff --git a/lib/src/methods.dart b/lib/src/methods.dart index cf9b992..1e30737 100644 --- a/lib/src/methods.dart +++ b/lib/src/methods.dart @@ -2,12 +2,14 @@ import 'package:qs_dart/src/models/decode_options.dart'; import 'package:qs_dart/src/models/encode_options.dart'; import 'package:qs_dart/src/qs.dart'; +/// Convenience method for [QS.decode] Map decode( dynamic input, [ DecodeOptions options = const DecodeOptions(), ]) => QS.decode(input, options); +/// Convenience method for [QS.encode] String encode( Object? object, [ EncodeOptions options = const EncodeOptions(), diff --git a/lib/src/qs.dart b/lib/src/qs.dart index 4c8dd12..ad151ec 100644 --- a/lib/src/qs.dart +++ b/lib/src/qs.dart @@ -1,5 +1,5 @@ import 'dart:convert' show latin1, utf8, Encoding; -import 'dart:typed_data'; +import 'dart:typed_data' show ByteBuffer; import 'package:qs_dart/src/enums/duplicates.dart'; import 'package:qs_dart/src/enums/format.dart'; @@ -15,7 +15,10 @@ part 'extensions/decode.dart'; part 'extensions/encode.dart'; +/// A query string decoder (parser) and encoder (stringifier) class. final class QS { + /// Decodes a [String] or [Map] into a [Map]. + /// Providing custom [options] will override the default behavior. static Map decode( dynamic input, [ DecodeOptions options = const DecodeOptions(), @@ -53,6 +56,8 @@ final class QS { return Utils.compact(obj); } + /// Encodes an [Object] into a query [String]. + /// Providing custom [options] will override the default behavior. static String encode( Object? object, [ EncodeOptions options = const EncodeOptions(), diff --git a/lib/src/utils.dart b/lib/src/utils.dart index 8cb00c3..771579b 100644 --- a/lib/src/utils.dart +++ b/lib/src/utils.dart @@ -11,6 +11,7 @@ import 'package:qs_dart/src/models/undefined.dart'; part 'constants/hex_table.dart'; +/// A collection of utility methods used by the library. @internal final class Utils { static dynamic merge(