Dart grammar checker quickstart
Send text to the edits endpoint. Sapling returns suggested replacements with character offsets so your application can review or apply each correction.
No language-specific SDK is required. The example uses a standard or commonly used HTTP client to call Sapling's JSON API.
Dart
/api/v1/edits
void main() async {
final response = await http.post(
Uri.parse('https://api.sapling.ai/api/v1/edits'),
headers: {
'Content-Type': 'application/json; charset=UTF-8',
},
body: jsonEncode({
'key': 'API_KEY',
'text': 'Lets get started!',
'session_id': 'Test Document UUID',
}),
);
print(jsonDecode(response.body));
}
Example response
application/json
{
"edits": [
{
"start": 0,
"end": 4,
"replacement": "Let's",
"sentence": "Lets get started!",
"error_type": "R:OTHER"
}
]
}
Each edit identifies the source range and replacement text. Preserve the original offsets when applying more than one edit.
About Dart
Dart is a programing language developed by Google. Applications in Dart are compiled to native code or JavaScript for cross-platform use on server, web, desktop and mobile applications. This is the language used by the cross-platform application framework Flutter.