Skip to content

Commit

Permalink
dart fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gmpassos committed Dec 19, 2024
1 parent e11d6b6 commit a035723
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 18 deletions.
4 changes: 0 additions & 4 deletions lib/src/bones_api_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1144,8 +1144,6 @@ extension APIRequestMethodExtension on APIRequestMethod {
return 'OPTIONS';
case APIRequestMethod.HEAD:
return 'HEAD';
default:
throw ArgumentError('Unknown method: $this');
}
}
}
Expand Down Expand Up @@ -1240,8 +1238,6 @@ extension APIRequesterSourceExtension on APIRequesterSource {
return 'remote';
case APIRequesterSource.unknown:
return 'unknown';
default:
throw ArgumentError('Unknown: $this');
}
}
}
Expand Down
16 changes: 12 additions & 4 deletions lib/src/bones_api_entity.dart
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,9 @@ abstract class EntityHandler<O> with FieldsFromMap, EntityRulesResolver {
type == Decimal ||
type == DynamicInt ||
type == DynamicNumber ||
type == Uint8List) return true;
type == Uint8List) {
return true;
}

return false;
}
Expand Down Expand Up @@ -1563,7 +1565,9 @@ abstract class EntityHandler<O> with FieldsFromMap, EntityRulesResolver {
var fieldsNames = this.fieldsNames(o);
for (var f in fieldsNames) {
if (!_isValidFieldValueImpl<dynamic>(
o, f, null, false, validatedEntities)) return false;
o, f, null, false, validatedEntities)) {
return false;
}
}
return true;
}
Expand Down Expand Up @@ -3169,7 +3173,9 @@ abstract class EntityStorage<O extends Object> extends EntityAccessor<O> {
var fieldValues = entityHandler.getField(o, e.key);
if (fieldValues == null ||
fieldValues is! Iterable ||
fieldValues.nonNulls.isEmpty) continue;
fieldValues.nonNulls.isEmpty) {
continue;
}

EntityRepository<Object>? tEntityRepository;
EntityHandler<Object>? tEntityHandler;
Expand Down Expand Up @@ -4259,7 +4265,9 @@ abstract class EntityRepository<O extends Object> extends EntityAccessor<O>
o is DynamicNumber ||
o is DateTime ||
o is Time ||
o is Enum) return o;
o is Enum) {
return o;
}

if (o is EntityReferenceBase) {
return o.copy();
Expand Down
8 changes: 6 additions & 2 deletions lib/src/bones_api_entity_reference.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2480,7 +2480,9 @@ class EntityReferenceList<T> extends EntityReferenceBase<T> {
}
} else if (otherEntities is T) {
if (isEntitiesSet &&
_listIdenticalEquality.equals(entities, [otherEntities])) return true;
_listIdenticalEquality.equals(entities, [otherEntities])) {
return true;
}

var entityHandler = this.entityHandler;

Expand All @@ -2492,7 +2494,9 @@ class EntityReferenceList<T> extends EntityReferenceBase<T> {
return null;
} else if (otherEntities is List<T?>) {
if (isEntitiesSet &&
_listIdenticalEquality.equals(entities, otherEntities)) return true;
_listIdenticalEquality.equals(entities, otherEntities)) {
return true;
}

var entityHandler = this.entityHandler;

Expand Down
2 changes: 0 additions & 2 deletions lib/src/bones_api_platform.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ extension APIPlatformTypeExtension on APIPlatformType {
return 'macos';
case APIPlatformType.windows:
return 'windows';
default:
throw StateError('Unknown: $this');
}
}
}
Expand Down
3 changes: 0 additions & 3 deletions lib/src/bones_api_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2497,9 +2497,6 @@ final class APIServerWorker extends _APIServerBase {

return Response.internalServerError(body: retError, headers: headers);
}
default:
return Response.notFound('NOT FOUND[${request.method}]: ${request.url}',
headers: headers);
}
}

Expand Down
12 changes: 9 additions & 3 deletions lib/src/bones_api_utils_collections.dart
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,9 @@ extension RecordExtension on Record {
Object?,
Object?,
Object?
)) return 8;
)) {
return 8;
}

if (o is (
Object?,
Expand All @@ -748,7 +750,9 @@ extension RecordExtension on Record {
Object?,
Object?,
Object?
)) return 9;
)) {
return 9;
}

if (o is (
Object?,
Expand All @@ -761,7 +765,9 @@ extension RecordExtension on Record {
Object?,
Object?,
Object?
)) return 10;
)) {
return 10;
}

return -1;
}
Expand Down

0 comments on commit a035723

Please sign in to comment.