diff --git a/api/packages/crossword_repository/lib/src/crossword_repository.dart b/api/packages/crossword_repository/lib/src/crossword_repository.dart index f9c1f226d..0228a09d3 100644 --- a/api/packages/crossword_repository/lib/src/crossword_repository.dart +++ b/api/packages/crossword_repository/lib/src/crossword_repository.dart @@ -142,7 +142,7 @@ class CrosswordRepository { ); final document = snapshot.first; - final solvedWordsCount = document.data['value'] as int; + final solvedWordsCount = (document.data['value'] as num).toInt(); final newValue = solvedWordsCount + 1; await _dbClient.update( diff --git a/api/packages/game_domain/lib/src/models/point_converter.dart b/api/packages/game_domain/lib/src/models/point_converter.dart index b201d51e6..50f9e01a5 100644 --- a/api/packages/game_domain/lib/src/models/point_converter.dart +++ b/api/packages/game_domain/lib/src/models/point_converter.dart @@ -11,8 +11,8 @@ class PointConverter extends JsonConverter, Map> { @override Point fromJson(Map json) { return Point( - json['x'] as int, - json['y'] as int, + (json['x'] as num).toInt(), + (json['y'] as num).toInt(), ); } diff --git a/api/packages/jwt_middleware/lib/src/jwt.dart b/api/packages/jwt_middleware/lib/src/jwt.dart index c7f7f3b02..27565d439 100644 --- a/api/packages/jwt_middleware/lib/src/jwt.dart +++ b/api/packages/jwt_middleware/lib/src/jwt.dart @@ -76,12 +76,12 @@ class JWT { return false; } final nowSeconds = clock.now().millisecondsSinceEpoch ~/ 1000; - final exp = _payload['exp'] as int?; - final iat = _payload['iat'] as int?; + final exp = (_payload['exp'] as num?)?.toInt(); + final iat = (_payload['iat'] as num?)?.toInt(); final aud = _payload['aud'] as String?; final iss = _payload['iss'] as String?; final sub = _payload['sub'] as String?; - final authTime = _payload['auth_time'] as int?; + final authTime = (_payload['auth_time'] as num?)?.toInt(); final userId = _payload['user_id'] as String?; if (exp == null || diff --git a/api/routes/board/sections/[sectionId]/index.dart b/api/routes/board/sections/[sectionId]/index.dart index 292232b71..49fc09003 100644 --- a/api/routes/board/sections/[sectionId]/index.dart +++ b/api/routes/board/sections/[sectionId]/index.dart @@ -66,7 +66,7 @@ Future _onGroupPost(RequestContext request) async { final sections = body['sections'] as List; positions = sections .cast>() - .map((e) => (e['x'] as int, e['y'] as int)) + .map((e) => ((e['x'] as num).toInt(), (e['y'] as num).toInt())) .toList(); } catch (e) { return Response( diff --git a/packages/api_client/lib/src/resources/crossword_resource.dart b/packages/api_client/lib/src/resources/crossword_resource.dart index 143a67bf3..1ca58b862 100644 --- a/packages/api_client/lib/src/resources/crossword_resource.dart +++ b/packages/api_client/lib/src/resources/crossword_resource.dart @@ -40,7 +40,7 @@ class CrosswordResource { try { final body = jsonDecode(response.body) as Map; - final points = body['points'] as int; + final points = (body['points'] as num).toInt(); return points; } catch (error, stackTrace) { throw ApiClientError( diff --git a/packages/api_client/lib/src/resources/hint_resource.dart b/packages/api_client/lib/src/resources/hint_resource.dart index 759233a51..a3ce42bce 100644 --- a/packages/api_client/lib/src/resources/hint_resource.dart +++ b/packages/api_client/lib/src/resources/hint_resource.dart @@ -42,7 +42,7 @@ class HintResource { try { final body = jsonDecode(response.body) as Map; final hint = Hint.fromJson(body['hint'] as Map); - final maxHints = body['maxHints'] as int; + final maxHints = (body['maxHints'] as num).toInt(); return (hint, maxHints); } catch (error, stackTrace) { throw ApiClientError( @@ -79,7 +79,7 @@ class HintResource { final hints = (body['hints'] as List) .map((hint) => Hint.fromJson(hint as Map)) .toList(); - final maxHints = body['maxHints'] as int; + final maxHints = (body['maxHints'] as num).toInt(); return (hints, maxHints); } catch (error, stackTrace) { throw ApiClientError( diff --git a/packages/board_info_repository/lib/src/board_info_repository.dart b/packages/board_info_repository/lib/src/board_info_repository.dart index 54f88a41d..294dbd73d 100644 --- a/packages/board_info_repository/lib/src/board_info_repository.dart +++ b/packages/board_info_repository/lib/src/board_info_repository.dart @@ -43,7 +43,7 @@ class BoardInfoRepository { return boardInfoCollection .where('type', isEqualTo: 'total_words_count') .snapshots() - .map((event) => event.docs.first.data()['value'] as int); + .map((event) => (event.docs.first.data()['value'] as num).toInt()); } catch (error, stackStrace) { throw BoardInfoException(error, stackStrace); } @@ -55,7 +55,7 @@ class BoardInfoRepository { return boardInfoCollection .where('type', isEqualTo: 'solved_words_count') .snapshots() - .map((event) => event.docs.first.data()['value'] as int); + .map((event) => (event.docs.first.data()['value'] as num).toInt()); } catch (error, stackStrace) { throw BoardInfoException(error, stackStrace); } @@ -69,7 +69,7 @@ class BoardInfoRepository { .get(); final data = results.docs.first.data(); - return data['value'] as int; + return (data['value'] as num).toInt(); } catch (error, stackStrace) { throw BoardInfoException(error, stackStrace); } @@ -83,7 +83,7 @@ class BoardInfoRepository { .get(); final data = results.docs.first.data(); - return data['value'] as double; + return (data['value'] as num).toDouble(); } catch (error, stackStrace) { throw BoardInfoException(error, stackStrace); }