From cd8e4e2e4ceeb69f32064cbdeec9fbbe1d3bb38b Mon Sep 17 00:00:00 2001 From: Jan Romann Date: Thu, 30 Nov 2023 08:48:11 +0100 Subject: [PATCH 1/2] Improve coding style in README example --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 97cc6d2..ee2026b 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,8 @@ UriMatch is the result of `UriPattern.match()`. It contains the parameters parse UriTemplate is an implementation of [RFC 6570 URI Templates][rfc6570]. URI Templates are useful for generating URIs from data. UriTemplates are created from a template string, and then expanded with data to generate a URI: ```dart -var template = UriTemplate("http://example.com/~{user}/"); -String fredUri = template.expand({'user': 'fred'}); +final template = UriTemplate('http://example.com/~{user}/'); +final fredUri = template.expand({'user': 'fred'}); print(fredUri); // prints: http://example.com/~fred/ ``` From 52ac89a46d9317d3b8c5aa4472a897adb392d98f Mon Sep 17 00:00:00 2001 From: Jan Romann Date: Thu, 30 Nov 2023 08:49:37 +0100 Subject: [PATCH 2/2] Add example to the example directory --- example/example.dart | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 example/example.dart diff --git a/example/example.dart b/example/example.dart new file mode 100644 index 0000000..ef9c3b5 --- /dev/null +++ b/example/example.dart @@ -0,0 +1,11 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:uri/uri.dart'; + +void main() { + final template = UriTemplate('http://example.com/~{user}/'); + final fredUri = template.expand({'user': 'fred'}); + print(fredUri); // prints: http://example.com/~fred/ +}