mirror of https://github.com/flutter/samples.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
9 lines
277 B
9 lines
277 B
8 months ago
|
String cleanJson(String maybeInvalidJson) {
|
||
|
if (maybeInvalidJson.contains('```')) {
|
||
|
final withoutLeading = maybeInvalidJson.split('```json').last;
|
||
|
final withoutTrailing = withoutLeading.split('```').first;
|
||
|
return withoutTrailing;
|
||
|
}
|
||
|
return maybeInvalidJson;
|
||
|
}
|