DChisel is simple Dart Framework for creating REST API

Overview

Dchisel Logo

DChisel Dart Framework

DChisel is simple Dart Framework for creating REST API

pub package

English Documentation Indonesia Documentation

Features

  • Custom host server and port
  • GET, POST, PUT, DELETE, PATCH Routes
  • ORM CRUD to PostgreSQL
  • ORM CRUD to MySQL

Usage

To add the dchisel to your Dart application read the install instructions.

Host Server

Default host is "localhost" and port 8000

import 'package:dchisel/dchisel.dart';

Future<void> main(List<String> arguments) async {
  DChisel().serve();
}

If you want to change the host to 0.0.0.0 and port to 5555 you can use :

 DChisel().serve(serverHost: '0.0.0.0', serverPort: 5555);

GET Route

DChisel().routeGet('/hello', (Request request) {
    return 'Hello, World';
});

GET with param you can use :

DChisel().routeGet('/getparam/<name>', (Request request, String name) {
    return 'Hello, $name';
});

POST Route

DChisel().routePost('/hello', (Request request) async {
    return 'Hello, World';
});

If you want to get Body value from your POST request, use :

var body = await request.body.asJson;

If you want to get Header value from your POST request, use :

var headers = await request.headers;

PUT Route

DChisel().routePut('/hello/<name>', (Request request, String name) async {
  return 'Hello, $name';
});

PUT also can get Header and Body request

var headers = await request.headers;
var body = await request.body.asJson;

DELETE Route

DChisel().routeDelete('/hello/<name>', (Request request, String name) async {
  return 'Hello, $name';
});

Dchisel ORM

For now, DChisel only support PostgreSQL and MySQL

DB Config

DChiselDB().configDB('dialect', // DIALECT DATABASE, IF YOU USE POSTGRESQL CHANGE 'dialect' to 'postgre', IF YOU USE MYSQL CHANGE 'dialect' to 'mysql'
    host: 'your_host',
    db: 'your_db_name',
    port: your_port, //integer
    username: 'your_db_username',
    password: 'your_db_password');

Get All Data

DChiselDB().getAll('your_table_name');

Get Data With Custom Column and Filter

DChiselDB().getOption('your_table_name', 
    column: 'your_column1,your_column2', 
    where: ['your_column_name', 'your_filter_value']);

If you want filter contains, just add % into your filter value, example :

'%your_filter_value%'

Create Data

DChiselDB().create('users', data: {
    'your_column_name': 'your_value'
});

Update Data

DChiselDB().update('users', data: {
    'your_column_name': 'your_value'
}, where: ['your_filter_column_name', 'your_filter_value']);

Delete Data

DChiselDB().deleteAll('your_table_name');

Delete Data Custom Filter

DChiselDB().deleteOption('your_table_name', where: ['your_filter_column_name', 'your_filter_value']);

Issues

Please file any issues, bugs or feature requests as an issue on our GitHub page. Commercial support is available, you can contact us at [email protected].

Want to contribute

If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a cool new feature), please carefully review our contribution guide and send us your pull request.

Author

This dchisel framework for Dart is developed by Alphacsoft.

You might also like...

News Headline app is build in Flutter MVVM and REST Apis for News is used in this app.

News Headline app is build in Flutter MVVM and REST Apis for News is used in this app.

About The Project Flutter MVVM project for News Headlines. REST Api for News is used in this project. App Demo Api for News Get free api from here : h

Aug 16, 2022

Weather-App-Api- - Simple Realtime Weather App With Api

Weather-App-Api- - Simple Realtime Weather App With Api

music_app A new Flutter Weather App project. Getting Started // اول حاجه تعمل en

Nov 11, 2022

A tutorial for creating an Ubuntu Linux Flutter app, using the yaru theme

A tutorial for creating an Ubuntu Linux Flutter app, using the yaru theme

Building a Yaru app with Flutter Summary URL https://github.com/ubuntu/user_manager Category Environment Linux Status Feedback Link Author Frederik Fe

Dec 21, 2022

FlutterCardSwipe Card Swipe Animation Creating the swipe view as used in the Tinder.

FlutterCardSwipe Card Swipe Animation Creating the swipe view as used in the Tinder.

FlutterCardSwipe Card Swipe Animation Creating the swipe view as used in the Tinder. Swipe right is considered accepted and swipe left is rejected.It

Dec 27, 2022

IIITB Hogwarts is a project which aims at increasing students' interest in creating projects and giving them a platform to share them with others.

IIITB-Hogwarts This is going to be fun project for our college students. Thinking of bringing Harry Potter style group division into college. This is

Nov 9, 2022

A sample for creating a nice movie details page UI in Flutter.

A sample for creating a nice movie details page UI in Flutter.

What is it? Sample project for creating a beautiful movie details UI in Flutter. Read the blogpost here. All the related source code is located in the

Dec 19, 2022

A powerful Flutter chat UI component library and business logic for Tencent Cloud Chat, creating seamless in-app chat modules for delightful user experiences.

A powerful Flutter chat UI component library and business logic for Tencent Cloud Chat, creating seamless in-app chat modules for delightful user experiences.

style .button-9 { appearance: button; backface-visibility: hidden; background-color: #1d52d9; border-radius: 6px; border-width: 0; box-shadow: rgba(

Aug 11, 2023

An Advanced Logging Framework develop in flutter that provides quick & simple logging solution.

An Advanced Logging Framework develop in flutter that provides quick & simple logging solution.

FLogs Advance Logging Framework FLog is an Advanced Logging Framework develop in flutter that provides quick & simple logging solution. All logs are s

Dec 30, 2022

server side dart micro-framework to handle incoming http requests

Queen Palace 🏰👑 Introduction server side dart micro-framework to handle incoming http requests

Aug 30, 2022
Comments
  • RangeError when there are more than one routes of the same type (except GET)

    RangeError when there are more than one routes of the same type (except GET)

    Edit: Tested using the latest version available on pub.dev

    Unhandled exception:
    RangeError (index): Invalid value: Only valid value is 0: 1
    #0      List.[] (dart:core-patch/growable_array.dart:264:36)
    #1      DChisel.serve.routerData
    package:dchisel/src/dchiselServer.dart:120
    #2      DChisel.serve.createServer
    package:dchisel/src/dchiselServer.dart:140
    #3      DChisel.serve
    package:dchisel/src/dchiselServer.dart:146
    #4      main
    bin/server.dart:65
    #5      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:295:32)
    #6      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
    
    
    ===== CRASH =====
    si_signo=Segmentation fault(11), si_code=1, si_addr=0x10
    Exited (sigsegv)
    opened by Zateros 0
Owner
M Nasrul Alawy
Im a CEO of Alphacsoft. My Basic Prog.Language is C#, But In Job, I Take Python or Golang for Web Backend, React.Js for Web Frontend, Java or Kotlin For Android
M Nasrul Alawy
Simple and modern news app that incorporates REST API (newsapi.org), all built entirely with Flutter.

A simple news app with a minimalistic and clean UI that incorporates the newsapi.org api all built entirely with Flutter. Be sure to leave a star ??

Carlton Aikins 73 Dec 1, 2022
A simple app to demonstrate a testable, maintainable, and scalable architecture for flutter. flutter_bloc, hive, and REST API are some of the tech stacks used in this project.

last_fm A simple app to demonstrate a testable, maintainable, and scalable architecture for flutter. flutter_bloc, hive, and REST API are some of the

Elias Andualem 140 Dec 31, 2022
Rest API Movie Application built using Flutter and Riverpod

Flickd Flutter Application Flickd Movie Application Flutter Flutter allows you to build beautiful native apps on iOS and Android Platforms from a sing

null 20 Dec 5, 2022
How to integrate REST API in Flutter

FLUTTER REST API How to integrate REST API in Flutter Introduction: In this article we will learn how to integrate REST API in flutter app. As we know

Hoàng Phong 2 Aug 22, 2021
Flutter-Covid-19-App - A flutter Covid-19 Trakcer app with Rest API

covid_tracker I have created this app flutter with Rest API, API is open source.

Asif Taj 14 Jan 4, 2023
Flutter apple music preview - A Music App that leverages the iTunes Rest API to get music data and playable music trailers

Apple Music Preview App Description This project is a Music App that leverages t

Willy Adinata Saragih 2 May 23, 2022
Weather App for cities using Rest API

Clima, A City Weather mobile app Clima is a Weather App for cities which makes use of Powerful Flutter Platform to run on both Android and iOS devices

Zain Basharat Ali 4 Nov 29, 2022
A Dart library for creating a Dart object to represent directory trees.

Directory Tree A Dart library for creating a Dart object to represent directory trees. Getting Started Import and initialize package import 'package:d

Chiziaruhoma Ogbonda 5 Dec 1, 2021
A API integrated 5 day weather forecast and prediction application created using flutter framework and Dart language.

A API integrated 5 day weather forecast and prediction application created using flutter framework and Dart language. This API used here is OPEN WEATHER API, which specializes in predicting the weather of any city in this world.

Nitin Verma 0 Dec 26, 2021
Friendly-Chat - Simple text messaging app coded in Dart using the Flutter framework

Friendly Chat A mobile application coded in the Dart programming language using

Vladislav Kostic 3 May 15, 2022