Skip to content

Commit

Permalink
merge v3.1.3
Browse files Browse the repository at this point in the history
- Code adjustments for `lints: ^2.0.1`.
- intl: ^0.18.0
- resource_portable: ^3.0.1
- lints: ^2.0.1
- test: ^1.22.1
  • Loading branch information
gmpassos authored Dec 21, 2022
2 parents 8abf1b5 + 0109ef4 commit 536f7ab
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 26 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 3.1.3

- Code adjustments for `lints: ^2.0.1`.
- intl: ^0.18.0
- resource_portable: ^3.0.1
- lints: ^2.0.1
- test: ^1.22.1

## 3.1.2

- `DataURLBase64`:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![pub package](https://img.shields.io/pub/v/swiss_knife.svg?logo=dart&logoColor=00b9fc)](https://pub.dartlang.org/packages/swiss_knife)
[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety)
[![CI](https://img.shields.io/github/workflow/status/gmpassos/swiss_knife/Dart%20CI/master?logo=github-actions&logoColor=white)](https://github.com/gmpassos/swiss_knife/actions)
[![Dart CI](https://github.com/gmpassos/swiss_knife/actions/workflows/dart.yml/badge.svg?branch=master)](https://github.com/gmpassos/swiss_knife/actions/workflows/dart.yml)
[![GitHub Tag](https://img.shields.io/github/v/tag/gmpassos/swiss_knife?logo=git&logoColor=white)](https://github.com/gmpassos/swiss_knife/releases)
[![New Commits](https://img.shields.io/github/commits-since/gmpassos/swiss_knife/latest?logo=git&logoColor=white)](https://github.com/gmpassos/swiss_knife/network)
[![Last Commits](https://img.shields.io/github/last-commit/gmpassos/swiss_knife?logo=git&logoColor=white)](https://github.com/gmpassos/swiss_knife/commits/master)
Expand Down
5 changes: 2 additions & 3 deletions lib/src/collections.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1466,7 +1466,7 @@ Map<K, V>? deepCopyMap<K, V>(Map<K, V>? map, {Copier? copier}) {
if (map == null) return null;
if (map.isEmpty) return <K, V>{};
return map.map((K k, V v) => MapEntry<K, V>(
deepCopy(k, copier: copier)!, deepCopy(v, copier: copier)!));
deepCopy(k, copier: copier) as K, deepCopy(v, copier: copier) as V));
}

typedef ValueFilter = bool Function(
Expand Down Expand Up @@ -2802,8 +2802,7 @@ class TreeReferenceMap<K, V> implements Map<K, V> {

/// Walks tree from [root] and stops when [walker] returns some [R] object.
R? walkTree<R>(R Function(K node) walker, {K? root}) {
root ??= this.root;
return _walkTreeImpl(root!, walker);
return _walkTreeImpl(root ?? this.root, walker);
}

R? _walkTreeImpl<R>(K node, R Function(K node) walker) {
Expand Down
10 changes: 5 additions & 5 deletions lib/src/data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ class Geolocation {
}

static String formatGeolocation(Point geo) {
return formatLatitude(geo.x) + ' ' + formatLongitude(geo.y);
return '${formatLatitude(geo.x)} ${formatLongitude(geo.y)}';
}

final num _latitude;
Expand Down Expand Up @@ -851,9 +851,9 @@ String? dataSizeFormat(int? size, {bool? decimalBase, bool? binaryBase}) {
var s = '${size ~/ 1000} KB';
return s;
} else if (size < 1000 * 1000 * 1000) {
return formatDecimal(size / (1000 * 1000))! + ' MB';
return '${formatDecimal(size / (1000 * 1000))!} MB';
} else {
return formatDecimal(size / (1000 * 1000 * 1000))! + ' GB';
return '${formatDecimal(size / (1000 * 1000 * 1000))!} GB';
}
} else {
if (size < 1024) {
Expand All @@ -862,9 +862,9 @@ String? dataSizeFormat(int? size, {bool? decimalBase, bool? binaryBase}) {
var s = '${size ~/ 1024} KiB';
return s;
} else if (size < 1024 * 1024 * 1024) {
return formatDecimal(size / (1024 * 1024))! + ' MiB';
return '${formatDecimal(size / (1024 * 1024))!} MiB';
} else {
return formatDecimal(size / (1024 * 1024 * 1024))! + ' GiB';
return '${formatDecimal(size / (1024 * 1024 * 1024))!} GiB';
}
}
}
2 changes: 1 addition & 1 deletion lib/src/events.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1308,7 +1308,7 @@ class UniqueCaller<R> {
stackTraceIdentifier?.toString() ??
UniqueCaller.stackTraceIdentifier());

_IdentifierWrapper get identifier => _identifier;
Object get identifier => _identifier;

static final Set<_IdentifierWrapper> _calling = {};

Expand Down
6 changes: 5 additions & 1 deletion lib/src/math.dart
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,11 @@ class Scale<T> {
// ignore: empty_catches
catch (ignore) {}

_length = length!;
if (length == null) {
throw StateError("Can't compute scale length!");
}

_length = length;
}

static Scale? from<T>(Iterable? list) {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/resource.dart
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ class ResourceContent {
var uri = reference != null ? await reference.uriResolved : null;
uri ??= await ResourceContent.fromURI('./')!.uriResolved;

var uriPath = Uri.decodeComponent(uri!.path) + '/';
var uriPath = '${Uri.decodeComponent(uri!.path)}/';

var uriPathParts = uriPath.split('/');
if (uriPath.endsWith('/')) uriPathParts.removeLast();
Expand Down
13 changes: 5 additions & 8 deletions lib/src/uri.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ String getUriBaseHostAndPort({bool suppressPort80 = true, int? port}) {

/// Returns base Uri as URL string.
String getUriRootURL({bool suppressPort80 = true, int? port}) {
return getUriBaseScheme() +
'://' +
getUriBaseHostAndPort(suppressPort80: suppressPort80, port: port) +
'/';
return '${getUriBaseScheme()}://${getUriBaseHostAndPort(suppressPort80: suppressPort80, port: port)}/';
}

/// Builds an Uri with the parameters.
Expand Down Expand Up @@ -97,7 +94,7 @@ Uri buildUri(String? scheme, String? host, int? port,
if (fragment == null) {
fragment = pathFragment;
} else {
fragment = pathFragment + '&' + fragment;
fragment = '$pathFragment&$fragment';
}

fragmentFromPath = true;
Expand All @@ -118,7 +115,7 @@ Uri buildUri(String? scheme, String? host, int? port,
if (queryString == null) {
queryString = pathQuery;
} else {
queryString = pathQuery + '&' + queryString;
queryString = '$pathQuery&$queryString';
}

queryStringFromPath = true;
Expand All @@ -144,7 +141,7 @@ Uri buildUri(String? scheme, String? host, int? port,
if (fragmentFromPath) {
fragment = path2Fragment;
} else {
fragment = path2Fragment + '&' + fragment;
fragment = '$path2Fragment&$fragment';
}
}

Expand Down Expand Up @@ -172,7 +169,7 @@ Uri buildUri(String? scheme, String? host, int? port,
if (queryStringFromPath) {
queryString = path2Query;
} else {
queryString = path2Query + '&' + queryString;
queryString = '$path2Query&$queryString';
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/src/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ String encodeQueryString(Map<String, String>? parameters) {

parameters.forEach((key, value) {
var pair =
Uri.encodeQueryComponent(key) + '=' + Uri.encodeQueryComponent(value);
'${Uri.encodeQueryComponent(key)}=${Uri.encodeQueryComponent(value)}';
pairs.add(pair);
});

Expand Down
10 changes: 5 additions & 5 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: swiss_knife
description: Dart Useful Tools - collections, math, date, uri, json, events, resources, regexp, etc...
version: 3.1.2
version: 3.1.3
homepage: https://github.com/gmpassos/swiss_knife

environment:
sdk: '>=2.12.0 <3.0.0'

dependencies:
intl: ^0.17.0
resource_portable: ^3.0.0
intl: ^0.18.0
resource_portable: ^3.0.1

dev_dependencies:
lints: ^1.0.1
test: ^1.17.12
lints: ^2.0.1
test: ^1.22.1
dependency_validator: ^3.2.2
collection: ^1.17.0
coverage: ^1.6.1
Expand Down

0 comments on commit 536f7ab

Please sign in to comment.