Simple and easy-to-use Dart wrapper for HackerEarth API (Compile & Run)

Overview

HackerEarth API

logo

Simple and easy-to-use Dart wrapper for HackerEarth API which provides endpoints for compiling and running code in several languages.

Usage

A simple usage example:

, memory_limit: 262144, time_used: 0.108346, signal: OTHER, status_detail: NA, status: AC, stderr: , output: Hello World!, async: 0, request_NOT_OK_reason: , request_OK: True }, compile_status: OK, web_link: https://code.hackerearth.com/2abc05e, code_id: 2abc05e } 4) Unsuccessful execution: { run_status: { status: CE, status_detail: Correct the compilation/syntax errors. }, compile_status: File "/hackerearth/PYTHON_2dda_30d1_0ad8_fef2/s_99dd_2250_d952_b026.py", line 4 print(list(map(lambda x: is a number, web_link: https://code.hackerearth.com/6b9837K, code_id: 6b9837K } */ print(response); print(hackerEarthApiWrapper.response); // same as above response variable /* 1) Successful execution response log with emojis: 💾 Memory Limit: 262144 💾 Memory Used: 64 ⏲ Time Limit: 5 ⏲ Time Used: 0.108573 ✔️ Status: AC 🆗 Compile Status: OK 🔗 Web Link: https://code.hackerearth.com/e288deG 🧾 Output: ---------- Hello World! [('1', '2', '3'), ('1', '3', '2'), ('2', '1', '3'), ('2', '3', '1'), ('3', '1', '2'), ('3', '2', '1')] ['0 is a number', '1 is a number', '2 is a number', '3 is a number', '4 is a number'] 2) Successful execution response log without emojis: Memory Limit: 262144 Memory Used: 64 Time Limit: 5 Time Used: 0.108573 Status: AC Compile Status: OK Web Link: https://code.hackerearth.com/e288deG Output: ------- Hello World! [('1', '2', '3'), ('1', '3', '2'), ('2', '1', '3'), ('2', '3', '1'), ('3', '1', '2'), ('3', '2', '1')] ['0 is a number', '1 is a number', '2 is a number', '3 is a number', '4 is a number'] */ String prettyLog = hackerEarthApiWrapper.responseLog(withEmoji: true); print(prettyLog); } ">
// Import this package
import 'package:hackerearth_api/hackerearth_api.dart';

void main() async {
    
    // Create instance and supply client_secret obtained from https://www.hackerearth.com/api/register/
    HackerEarthApiWrapper hackerEarthApiWrapper = HackerEarthApiWrapper(
        clientSecret: 'PUT_CLIENT_SECRET',
    );

    /**
    Call makeRequest method and supply following arguments:
    
        compileAndRun:
            - If it is true then code will be compiled and run.
            - Otherwise code will be compiled. (Default will be false if nothing is supplied)

        programmingLanguage:
            - Language.C
            - Language.CPP
            - Language.CPP11
            - Language.CLOJURE
            - Language.CSHARP
            - Language.GO
            - Language.JAVA
            - Language.JAVASCRIPT
            - Language.JAVASCRIPT_NODE
            - Language.HASKELL
            - Language.OBJECTIVEC
            - Language.PASCAL
            - Language.PERL
            - Language.PHP
            - Language.PYTHON
            - Language.R
            - Language.RUBY
            - Language.RUST
            - Language.SCALA
        
        sourceCode:
            - Add source code in a multiline string
    */
    Map<String, dynamic> response = await hackerEarthApiWrapper.makeRequest(
        compileAndRun: false,
        programmingLanguage: Language.PYTHON,
        sourceCode:
'''from itertools import permutations
print("Hello World!")
print(list(permutations('123')))
print(list(map(lambda x: str(x) + ' is a number', range(5))))''',
    );

    /*
    Sample Responses
    ----------------
    1) Successful compilation:
        {
            async: 0,
            compile_status: OK,
            web_link: https://code.hackerearth.com/d88c2di,
            code_id: d88c2di,
            id: d88c2di
        }
    
    2) Unsuccessful compilation:
        {
            async: 0,
            compile_status: File "/hackerearth/PYTHON_d077_d572_cdb9_ee8c/s_6ae6_4578_a41d_ecc3.py", line 4 print(list(map(lambda x: is a number,
            web_link: https://code.hackerearth.com/0641ffD,
            code_id: 0641ffD,
            id: 0641ffD
        }

    3) Successful execution:
        {
            run_status: {
                memory_used: 64,
                time_limit: 5,
                output_html: Hello World!
,
memory_limit: 262144, time_used: 0.108346, signal: OTHER, status_detail: NA, status: AC, stderr: , output: Hello World!, async: 0, request_NOT_OK_reason: , request_OK: True }, compile_status: OK, web_link: https://code.hackerearth.com/2abc05e, code_id: 2abc05e } 4) Unsuccessful execution: { run_status: { status: CE, status_detail: Correct the compilation/syntax errors. }, compile_status: File "/hackerearth/PYTHON_2dda_30d1_0ad8_fef2/s_99dd_2250_d952_b026.py", line 4 print(list(map(lambda x: is a number, web_link: https://code.hackerearth.com/6b9837K, code_id: 6b9837K } */ print(response); print(hackerEarthApiWrapper.response); // same as above response variable /* 1) Successful execution response log with emojis: 💾 Memory Limit: 262144 💾 Memory Used: 64 ⏲ Time Limit: 5 ⏲ Time Used: 0.108573 ✔️ Status: AC 🆗 Compile Status: OK 🔗 Web Link: https://code.hackerearth.com/e288deG 🧾 Output: ---------- Hello World! [('1', '2', '3'), ('1', '3', '2'), ('2', '1', '3'), ('2', '3', '1'), ('3', '1', '2'), ('3', '2', '1')] ['0 is a number', '1 is a number', '2 is a number', '3 is a number', '4 is a number'] 2) Successful execution response log without emojis: Memory Limit: 262144 Memory Used: 64 Time Limit: 5 Time Used: 0.108573 Status: AC Compile Status: OK Web Link: https://code.hackerearth.com/e288deG Output: ------- Hello World! [('1', '2', '3'), ('1', '3', '2'), ('2', '1', '3'), ('2', '3', '1'), ('3', '1', '2'), ('3', '2', '1')] ['0 is a number', '1 is a number', '2 is a number', '3 is a number', '4 is a number'] */ String prettyLog = hackerEarthApiWrapper.responseLog(withEmoji: true); print(prettyLog); }

Features and bugs

Please file feature requests and bugs at the issue tracker.

You might also like...

A Flutter widget that scrolls text widget and other widget

A Flutter widget that scrolls text widget and other widget

marquee_widget A Flutter widget that scrolls Widget Text and other Widget with supported RTL. Provides many customizationsincluding custom scroll dire

Nov 21, 2022

Toor makes service locators compile-time safe and easy to manage

🌱 What is Toor Toor makes service locators compile-time safe and easy to manage. 🚀 Getting Started Define your dependencies somewhere in the project

Jul 25, 2022

Flutter Navigation - all types of navigation in flutter run main.tabBar.dart to see tabBar, and run main.dart to see the otheres

pop_up_bar A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if th

Jan 1, 2022

Minimal Dart wrapper to interact with Some Random Api. Easy to use, simplified and lightweight.

SRA - Some Random Api Minimal Dart wrapper to interact with Some Random Api. Easy to use, simplified and lightweight. Getting started Add the package

Jan 4, 2023

Compile-time dependency injection for Dart and Flutter

package:inject Compile-time dependency injection for Dart and Flutter, similar to Dagger. NOTE: This is not an official Google or Dart team project. E

Dec 31, 2022

Flutter Advanced: Background Fetch | Run code in the background Android & iOS | Run code in the background Android & iOS

flutterbackground A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you starte

Dec 16, 2022

Magpie is a visualized platform which designed to create, develop and compile your standalone flutter module.

Magpie is a visualized platform which designed to create, develop and compile your standalone flutter module.

Magpie Workflow is a visualized platform which is designed to create, develop and compile your standalone flutter module;

Dec 4, 2022

Easy to use session wrapper that adds support to session storage and management in flutter.

flutter_session_manager Adds an easy to use wrapper to session management in flutter. Allows for easy session storage and management. The session pers

Feb 15, 2022

A simple flexible API wrapper for coinbase commerce API. Totally unofficial.

coinbase_commerce A dart library that connects to interact with the Coinbase Commerce API. Enables projects to connect seamlessly to coinbase and rece

Oct 17, 2021

A most easily usable RESAS API wrapper in Dart. With this library, you can easily integrate your application with the RESAS API.

A most easily usable RESAS API wrapper library in Dart! 1. About 1.1. What Is RESAS? 1.2. Introduction 1.2.1. Install Library 1.2.2. Import It 1.2.3.

Apr 7, 2022

Easy nav - A simple wrapper around flutter navigator, dialogs and snackbar to do those things without context

EasyNav Just a simple wrapper around flutter navigator, dialogs and snackbar to

Feb 26, 2022

Unofficial twitch open api - Wrapper for the newest Twitch API. It returns information about channels, media, search and game

📦 unofficial_twitch_auth This package allows to retrieve all the data by the ne

Feb 3, 2022

A simple Todo app designed to simply use GraphQL as backend and provide an easy to use UI/UX.

A simple Todo app designed to simply use GraphQL as backend and provide an easy to use UI/UX.

simple_todo_app A simple Todo app designed to simply use GraphQL as backend and provide an easy to use UI/UX. A breakdown of the project and explanati

Oct 9, 2022

A most easily usable Duolingo API wrapper in Dart. Duolingo4D is an open-sourced Dart library.

A most easily usable Duolingo API wrapper in Dart! 1. About Duolingo4D Duolingo4D is an open-sourced Dart library. With Duolingo4D, you can easily int

Oct 17, 2022

Easy to use, reliable and lightweight gesture detector for Flutter apps, exposing simple API for basic gestures

Simple Gesture Detector Easy to use, reliable and lightweight gesture detector for Flutter apps. Exposes simple API to react to basic gestures. Featur

Nov 4, 2022

A discord bot, made with Dart, which lets you run your own pure Dart code snippets directly via a discord ping, and get the output in an instant.

A discord bot, made with Dart, which lets you run your own pure Dart code snippets directly via a discord ping, and get the output in an instant.

A discord bot, made with Dart, which lets you run your own pure Dart code snippets directly via a discord ping, and get the output in an instant.

Oct 21, 2022

The lightweight and powerful wrapper library for Twitter Ads API written in Dart and Flutter 🐦

TODO: Put a short description of the package here that helps potential users know whether this package might be useful for them. Features TODO: List w

Aug 26, 2022

Flutter simple image crop - A simple and easy to use flutter plugin to crop image on iOS and Android

Flutter simple image crop - A simple and easy to use flutter plugin to crop image on iOS and Android

Image Zoom and Cropping plugin for Flutter A simple and easy used flutter plugin to crop image on iOS and Android. Installation Add simple_image_crop

Dec 14, 2021

A flutter widget to indicate loading progress. Easy to use, easy to extend

💙 👾 💫 A flutter widget to indicate loading progress. Easy to use, easy to extend

May 30, 2022
Learn Dart with this cheat sheet

Learn Dart with this cheat sheet This project starts from Hello World untill the end of the Dart :) Simple example Hello World in Dart void main() {

null 28 Nov 11, 2022
Learn Dart with this cheat sheet

Learn Dart with this cheat sheet This project starts from Hello World untill the end of the Dart :) Simple example Hello World in Dart void main() {

AmirHossein Mohammadi 8 Jan 16, 2022
Functional batteries for Dart programming language.

Lightweight and practical functional library for Dart programming language. The goal of this library is not having deep and hardcore FP features. If y

Kirill Bubochkin 15 Dec 17, 2022
App concept created with Flutter using Dart programming language, inspired by Multi Search By Categories.

Photography Explorer Flutter App App concept created with Flutter using Dart programming language, inspired by Multi Search By Categories. About This

Wilton Neto 103 Sep 28, 2022
❤️Flutter ❤️ tips and tricks ❤️ Awesome Flutter ❤️ tips and tricks ❤️

❤️ Awesome Flutter ❤️ tips and tricks ❤️ Tip 1 : stless & stful We can type stless and stful and we get Autocomplete Suggestion to generate Stateless

Laxman Bhattarai 2.8k Dec 28, 2022
Flutter tips and tricks to make the development smoother and easier

Table of Contents Custom Clippers in Flutter Check if Website is Up or Down in Dart Section Titles on ListView in Flutter Circular Progress in Flutter

Praharsh Bhatt 17 Oct 11, 2022
Based on Microsoft Fluent Design System and made using the help of Flutter VelocityX.

Vx Fluent UI for Flutter Based on Microsoft Fluent Design System and made using the help of Flutter VelocityX. VxFluentUI is a Flutter component libra

Pawan Kumar 14 Jan 28, 2022
It says it all. Not In Flutter Docs, a sort of underground guide to flutter app development and design.

Not In Flutter Docs It says it all. Not In Flutter Docs, a sort of underground guide to flutter app development and design. Licenses Code is under BSD

Fred Grott 56 Dec 27, 2022
A Flutter implementation of an expandable and animated floating search bar, also known as persistent search.

Material Floating Search Bar A Flutter implementation of an expandable floating search bar, also known as persistent search, similar to the ones used

null 390 Mar 3, 2022
Spreadsheet Decoder is a library for decoding spreadsheets for ODS and XLSX files.

Spreadsheet Decoder Spreadsheet Decoder is a library for decoding and updating spreadsheets for ODS and XLSX files. Usage On server-side import 'dart:

Stéphane Este-Gracias 41 Jan 5, 2023