apiverve_codedetector 1.2.3
apiverve_codedetector: ^1.2.3 copied to clipboard
Code Detector identifies the programming language of any submitted code snippet. It returns the canonical language name, readable title, and standard file extension for the detected code.
Code Detector API - Dart/Flutter Client #
Code Detector identifies the programming language of any submitted code snippet. It returns the canonical language name, readable title, and standard file extension for the detected code.
This is the Dart/Flutter client for the Code Detector API.
Installation #
Add this to your pubspec.yaml:
dependencies:
apiverve_codedetector: ^1.2.3
Then run:
dart pub get
# or for Flutter
flutter pub get
Usage #
import 'package:apiverve_codedetector/apiverve_codedetector.dart';
void main() async {
final client = CodedetectorClient('YOUR_API_KEY');
try {
final response = await client.execute({
'code': 'a = 5
b = 6
c = 7
# calculate the semi-perimeter
s = (a + b + c) / 2
# calculate the area
area = (s*(s-a)*(s-b)*(s-c)) ** 0.5
print(\'The area of the triangle is %0.2f\' %area)'
});
print('Status: ${response.status}');
print('Data: ${response.data}');
} catch (e) {
print('Error: $e');
}
}
Response #
{
"status": "ok",
"error": null,
"data": {
"likelihood": 0.99,
"family": "PYTHON",
"current": "python",
"readable": "Python Code",
"extension": ".py",
"paradigm": "multi-paradigm",
"isCompiled": false
}
}
API Reference #
- API Home: Code Detector API
- Documentation: docs.apiverve.com/ref/codedetector
Authentication #
All requests require an API key. Get yours at apiverve.com.
License #
MIT License - see LICENSE for details.
Built with Dart for APIVerve