Skip to content

Commit 71cd57f

Browse files
committed
Encode maps in lists as non-null maps
1 parent ab64998 commit 71cd57f

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/src/common/misc_service.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import 'dart:async';
2-
import 'dart:convert';
32
import 'package:github/src/common.dart';
43
import 'package:github/src/json.dart';
54

lib/src/json.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ class GitHubJson {
1616
static String encode(Object object, {String indent}) {
1717
final encoder = JsonEncoder.withIndent(indent, _toEncodable);
1818
if (object is Map) {
19-
object = createNonNullMap(object);
19+
object = createNonNullMap(object as Map, recursive: true);
20+
}
21+
if (object is List) {
22+
object = (object as List)
23+
.map((e) => e is Map ? createNonNullMap(e, recursive: true) : e)
24+
.toList();
2025
}
2126
return encoder.convert(object);
2227
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy