Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .fvmrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"flutter": "3.41.8",
"flutter": "3.41.9",
"flavors": {}
}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 3.8.12

- Made `position` field nullable (`InboundPositionStructure?`) in `InboundStructure` and `InboundStructureInput` to support services without a position structure.
- Added `DynamicMapConverter` and `DynamicMapConverterNullable` converters to safely deserialize `Map<dynamic, dynamic>` (e.g. Dart literal `{}`) into `Map<String, dynamic>`.
- Applied `@DynamicMapConverterNullable()` to `InboundService.credentials` and `@DynamicMapConverter()` to `InboundServiceInput.credentials` to fix deserialization failures when credentials arrive as an empty map literal.

## 3.8.11

- Adjustments on `Model`, now `widget` is `List<RenderWidget>` instead of plain `RenderWidget`.
Expand Down
2 changes: 2 additions & 0 deletions devtools_options.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
description: This file stores settings for Dart & Flutter DevTools.
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
extensions:
- drift: false
- shared_preferences: false
98 changes: 55 additions & 43 deletions lib/src/builder/builder.freezed.dart

Large diffs are not rendered by default.

20 changes: 12 additions & 8 deletions lib/src/builder/builder.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions lib/src/builder/src/inbound.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ part of '../builder.dart';
abstract class InboundStructure with _$InboundStructure {
const factory InboundStructure({
required bool hasPosition,
required InboundPositionStructure position,
required InboundPositionStructure? position,
required bool hasPayload,
required List<InboundPayloadStructure> payload,
}) = _InboundStructure;
Expand All @@ -19,7 +19,7 @@ abstract class InboundStructureInput with _$InboundStructureInput {
@Default(true) bool hasPosition,

/// [position] defines the structure of the position.
required InboundPositionStructureInput position,
required InboundPositionStructureInput? position,

/// [hasPayload] defines if the structure has a payload.
@Default(false) bool hasPayload,
Expand Down Expand Up @@ -90,7 +90,8 @@ enum InboundPayloadStructureType {
string,
integer,
boolean,
float;
float
;

@override
String toString() => toJson();
Expand Down
1 change: 1 addition & 0 deletions lib/src/converters/converters.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ part 'src/time_of_day.dart';
part 'src/regex.dart';
part 'src/byte_list.dart';
part 'src/param_converter.dart';
part 'src/dynamic_map.dart';
35 changes: 35 additions & 0 deletions lib/src/converters/src/dynamic_map.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
part of '../converters.dart';

/// Safely converts any [Map] into [Map<String, dynamic>?].
///
/// A Dart literal `{}` inside a `Map<String, dynamic>` value slot is
/// `Map<dynamic, dynamic>`, which fails the direct `as Map<String, dynamic>?`
/// cast that json_serializable emits. This converter handles both variants.
class DynamicMapConverterNullable implements JsonConverter<Map<String, dynamic>?, Object?> {
const DynamicMapConverterNullable();

@override
Map<String, dynamic>? fromJson(Object? json) {
if (json == null) return null;
if (json is Map<String, dynamic>) return json;
if (json is Map) return json.map((key, value) => MapEntry(key.toString(), value));
return null;
}

@override
Object? toJson(Map<String, dynamic>? value) => value;
}

class DynamicMapConverter implements JsonConverter<Map<String, dynamic>, Object?> {
const DynamicMapConverter();

@override
Map<String, dynamic> fromJson(Object? json) {
if (json is Map<String, dynamic>) return json;
if (json is Map) return json.map((key, value) => MapEntry(key.toString(), value));
return {};
}

@override
Object? toJson(Map<String, dynamic> value) => value;
}
34 changes: 17 additions & 17 deletions lib/src/inbound/inbound.freezed.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading