Dart 2 updates

This commit is contained in:
Tobe O 2018-06-22 23:36:02 -04:00
parent 09e1fc506e
commit a30ad98ee0
4 changed files with 25 additions and 18 deletions

2
CHANGELOG.md Normal file
View file

@ -0,0 +1,2 @@
# 1.0.0+1
* Dart 2 updates.

3
analysis_options.yaml Normal file
View file

@ -0,0 +1,3 @@
analyzer:
strong-mode:
implicit-casts: false

View file

@ -1,6 +1,6 @@
library angel_http_exception; library angel_http_exception;
import 'dart:convert'; import 'package:dart2_constant/convert.dart';
/// Basically the same as /// Basically the same as
/// [feathers-errors](https://github.com/feathersjs/feathers-errors). /// [feathers-errors](https://github.com/feathersjs/feathers-errors).
@ -47,13 +47,13 @@ class AngelHttpException implements Exception {
factory AngelHttpException.fromMap(Map data) { factory AngelHttpException.fromMap(Map data) {
return new AngelHttpException(null, return new AngelHttpException(null,
statusCode: data['status_code'] ?? data['statusCode'], statusCode: (data['status_code'] ?? data['statusCode']) as int,
message: data['message'], message: data['message']?.toString(),
errors: data['errors']); errors: (data['errors'] as Iterable)?.cast<String>()?.toList());
} }
factory AngelHttpException.fromJson(String json) => factory AngelHttpException.fromJson(String str) =>
new AngelHttpException.fromMap(JSON.decode(json)); new AngelHttpException.fromMap(json.decode(str) as Map);
/// Throws a 400 Bad Request error, including an optional arrray of (validation?) /// Throws a 400 Bad Request error, including an optional arrray of (validation?)
/// errors you specify. /// errors you specify.

View file

@ -1,7 +1,9 @@
name: angel_http_exception name: angel_http_exception
version: 1.0.0 version: 1.0.0+1
description: Angel's HTTP exception class. description: Angel's HTTP exception class.
author: Tobe O <thosakwe@gmail.com> author: Tobe O <thosakwe@gmail.com>
homepage: https://github.com/angel-dart/http_exception homepage: https://github.com/angel-dart/http_exception
environment: environment:
sdk: ">=1.19.0" sdk: ">=1.19.0 <3.0.0"
dependencies:
dart2_constant: ^1.0.0