Life-saving helpers for working with JavaScript libraries when compiling Dart/Flutter to Web.

Related tags

Templates dartified
Overview

dartified

Life-saving helpers for working with JavaScript libraries when compiling Dart/Flutter to Web.

Features

The functions included in this library will only work when you are compiling a Dart/Flutter project to Web.

Below are the included helpers so far:

  • isBasicType(value) - Checks if a value doesn't need to be converted between JavaScript and Dart.
  • dartify(dynamic object) - Converts a JavaScript object to what can be used in Dart.
  • jsify(Object object) - Converts a Dart object to what can be passed to JavaScript.
  • promiseToFuture(JsObject object) - Converts a JavaScript Promise object to Dart's Future object.

Usage

import 'dart:js' as js;

import 'package:dartified/dartified.dart';

/// An example using browser's fetch.
Future<void> main() async {
  try {
    var response = await Dartified.promiseToFuture(
      js.context.callMethod(
        Dartified.jsify('fetch'),
        [
          Dartified.jsify(
            'https://api.github.com/repos/javascript-tutorial/en.javascript.info/commits',
          ),
        ],
      ),
    );

    var json =
        await Dartified.promiseToFuture<String>(response.callMethod('json'));

    print(Dartified.dartify(json));
  } catch (e) {
    print('error: $e');
  }
}
You might also like...

Dialogs for picking and saving files in Android and in iOS.

flutter_file_dialog Dialogs for picking and saving files in Android and in iOS. Features Supports Android (API level 19 or later) and iOS (10.0 or lat

Dec 31, 2022

Send-a-msg - Send message to WhatsApp without saving number

Send-a-msg - Send message to WhatsApp without saving number

Send A Message Send Message to Whatsapp without saving number ToDo add logging s

Apr 3, 2022

Notefy - Task Saving App for both Android and iOS

Assignment for Flutter Developers Goal of the assignment is to: - Show the capa

Jan 25, 2022

Expense tracker - Build an app in flutter that can record the transaction we make in our daily life

Expense tracker - Build an app in flutter that can record the transaction we make in our daily life

expense_tracker I tried to build an app in flutter that can record the transacti

Nov 6, 2022

Magical 8 ball app will give you the answers to all the tricky questions in life

Magical 8 ball app will give you the answers to all the tricky questions in life

Magical 8 ball app will give you the answers to all the tricky questions in life. You can make the ball change at the press of a button.

Jan 6, 2022

The application contains the Noble Qur’an, Qur’an radio stations, morning and evening remembrances, and some supplications that a Muslim needs in his life, as well as prayer times, the direction of the qiblah, and the Forty-Nawawi book

The application contains the Noble Qur’an, Qur’an radio stations, morning and evening remembrances, and some supplications that a Muslim needs in his life, as well as prayer times, the direction of the qiblah, and the Forty-Nawawi book

The application contains the Noble Qur’an, Qur’an radio stations, morning and evening remembrances, and some supplications that a Muslim needs in his life, as well as prayer times, the direction of the qiblah, and the Forty-Nawawi book

Dec 15, 2022

Loop-dart - How to working loop in Dart

How to working loop in Dart list var list = [1, 2, 3, 4, 5, 6]; using for each

Feb 18, 2022

An examples of navigation with the Flutter and GetX libraries

An examples of navigation with the Flutter and GetX libraries

Ejemplos de navegación en Flutter Dentro de este repositorio podrán acceder a ej

Dec 22, 2021
Owner
Hammed Oyedele
Experienced software engineer with a strong background in developing award-winning web and mobile applications for diverse clients.
Hammed Oyedele
A dart package which provides a lot of helpers functions for easy development.

more_functions A dart package which provides a lot of helpers functions for easy development. Installation Add this to your packages pubspec.yaml file

Talat El Beick 0 Dec 5, 2021
Simple tool to open WhatsApp chat without saving the number, developed using Google's Flutter Framework. for Android/ IOS/ Desktop/ Web

OpenWp Simple tool to open WhatsApp chat without saving the number Explore the docs » View Demo · Report Bug · Request Feature Table of Contents About

Swarup Bhanja Chowdhury 15 Nov 1, 2022
A dart implementation of the chord.js javascript package to display beautiful chord diagrams

flutter_guitar_tabs This is a dart implementation of the chord.js javascript package to display beautiful chord diagrams like the ones below. Where to

null 20 Nov 16, 2022
Dart JS interop for Mermaid - The Javascript tool that makes use of a markdown based syntax to render customizable diagrams, charts and visualizations.

Mermaid (Dart) Dart JS interop for Mermaid - Javascript library that makes use of a markdown based syntax to render customizable diagrams, charts and

Tim Maffett 3 Dec 12, 2022
Dart equivalent of console.count() in JavaScript

fCount A Dart equivalent for console.count() in JavaScript. You can learn how it works on the web in the MDN docs Available on pub.dev ?? ?? But why U

Chinmay Kabi 2 Jul 31, 2022
MXFlutter 是一套使用 TypeScript/JavaScript 来开发 Flutter 应用的框架

MXFlutter 是一套使用 TypeScript/JavaScript 来开发 Flutter 应用的框架。 框架支持两种开发方式 基于 mxflutter-js 前端框架,使用 TypeScript 语言,以类似 Flutter 的 Widget 组

Tencent 719 Jan 3, 2023
Firebase API Client Libraries for Dart

?? Generated Firebase APIs for Dart. Additionally Includes private and unlisted APIs.

Invertase 19 Oct 18, 2022
A flutter plugin for retrieving, creating, saving, and watching contacts on native devices

flutter_contact A Flutter plugin to access and manage the device's native contacts. Usage To use this plugin, add flutter_contact as a dependency in y

Sunny 79 Nov 23, 2022
Flutter package for listening SMS code on Android, suggesting phone number, email, saving a credential.

Flutter Smart Auth From Tornike & Great Contributors Flutter package for listening SMS code on Android, suggesting phone number, email, saving a crede

Tornike 16 Jan 1, 2023
A degital diary with key feature of saving your thoughts with image

localstore 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

null 1 Nov 13, 2021