From 2a306e1ec3776cdc8f8ef8798a2cc269c1c63d6c Mon Sep 17 00:00:00 2001 From: Tobe O Date: Sun, 19 Aug 2018 23:20:12 -0400 Subject: [PATCH] Make parseId static + docs --- CHANGELOG.md | 5 ++++- lib/src/core/service.dart | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc9389b7..13b29b40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,4 +11,7 @@ * Moved `lib/hooks.dart` into `package:angel_hooks`. * Moved `TypedService` into `package:angel_typed_service`. * Completely removed the `AngelBase` class. -* Removed all `@deprecated` symbols. \ No newline at end of file +* Removed all `@deprecated` symbols. +* `Service.toId` was renamed to `Service.parseId`; it also now uses its +single type argument to determine how to parse a value. + * In addition, this method was also made `static`. \ No newline at end of file diff --git a/lib/src/core/service.dart b/lib/src/core/service.dart index 28dde7c3..f914297c 100644 --- a/lib/src/core/service.dart +++ b/lib/src/core/service.dart @@ -124,7 +124,11 @@ class Service extends Routable { } /// Transforms an [id] (whether it is a String, num, etc.) into one acceptable by a service. - T parseId(id) { + /// + /// The single type argument, [T], is used to determine how to parse the [id]. + /// + /// For example, `parseId` attempts to parse the value as a [bool]. + static T parseId(id) { if (id == 'null' || id == null) return null; else if (T == String)