Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hychen/flutter_js_context
Enhances the interoperability between Dart and flutter_js.
https://github.com/hychen/flutter_js_context
flutter
Last synced: about 2 months ago
JSON representation
Enhances the interoperability between Dart and flutter_js.
- Host: GitHub
- URL: https://github.com/hychen/flutter_js_context
- Owner: hychen
- License: mit
- Created: 2021-11-16T11:43:02.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-11-24T22:27:25.000Z (about 3 years ago)
- Last Synced: 2024-11-15T05:52:53.084Z (2 months ago)
- Topics: flutter
- Language: Dart
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
This package enhances the interoperability between Dart and [flutter_js](https://pub.dev/documentation/flutter_js/latest/).
## Features
Use this package to
- Track which variables are defined.
- Decode evaluated results that the type is assumed as JSON always.
- Load JavaScript file properly.## Getting started
```shell
flutter pub add flutter_js_context
```## Usage
```dart
import 'package:flutter_js_context/flutter_js_context.dart';void main() {
final context = JsContext();JsRef obj = JsRef.define(context, 'myvar', '1');
// equals 'var myvar[ref.key] = 4;' in JavaScript.
obj.update("4");// plus the object's value which is 4 and 4 in javascript runtime.
context.evaluate("${obj.toJsCode()} + 4"); // 8// plus the object's value which is 8 and 4 in dart.
print(obj.value + 4); // 12
}
```See `test` for more usage.
##