Search packages, repositories and app categories

Package detailsv4.0.0+1

dquery

DQuery is a porting of jQuery in Dart.

Web
30-day downloads
379
Likes
2
Pub points
105

Install package

flutter pub add dquery

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

DQuery is a Dart implementation of jQuery, designed to bring familiar DOM manipulation and event handling capabilities to web applications built with Flutter. It enables developers to select, traverse, and modify HTML elements using a syntax similar to jQuery, simplifying client-side web development. DQuery supports common operations like element selection, CSS manipulation, event binding, and AJAX-like requests, making it ideal for enhancing dynamic web interfaces. It runs exclusively on the web platform, leveraging Dart's interoperability with JavaScript.

Use cases

  • Simplifying DOM manipulation in Flutter web apps
  • Adding interactive behaviors to web UIs
  • Migrating jQuery-based logic to Dart
  • Enhancing web-specific functionality in Flutter projects

Key features

  • Familiar jQuery-style syntax
  • DOM selection and traversal
  • Event handling and delegation
  • CSS manipulation
  • AJAX-like request support

Suitable for

  • Flutter developers targeting web platforms
  • Teams familiar with jQuery
  • Projects requiring lightweight DOM interactions
  • Web-focused Flutter applications

Considerations

  • Limited to web platform only
  • Not suitable for mobile or desktop
  • May introduce JavaScript interop overhead
  • Better suited for simple DOM tasks than complex state management

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

DQuery

DQuery is a porting of jQuery in Dart.

Install from Dart Pub Repository

Include the following in your pubspec.yaml:

dependencies:
  dquery: any

Then run the Pub Package Manager in Dart Editor (Tool > Pub Install). If you are using a different editor, run the command (comes with the Dart SDK):

pub install

Usage

You can create a query object by selector. With context provided, the query will be based on different element.

// selects all elements containing 'active' in CSS class
ElementQuery $elems = $('.active');

// selects all descendant elements of div containing 'active' in CSS class
ElementQuery $elems = $('.active', div);

It implements List.

$('.active')[0];
$('.active').isEmpty;
for (Element e in $('.active')) { ... }

Create another query object with traversing API, including find, closest, parent, children.

$('.active').closest('ul');
$('#myDiv').find('a.btn');

Manipulate selected elements.

$('.active').removeClass('active');
$('.fade').hide();

Register event handlers on queried elements, or trigger an event by API.

$('#myBtn').on('click', (QueryEvent e) {
	...
});
$('#myBtn').trigger('click', data: 'my data');

There are query objects of Document and Window too.

Query $doc = $document();
Query $win = $window();

Check the API reference for more features.

Comparison to jQuery

See here.

Notes to Contributors

Test and Debug

You are welcome to submit bugs and feature requests. Or even better if you can fix or implement them!

Fork DQuery

If you'd like to contribute back to the core, you can fork this repository and send us a pull request, when it is ready.

Please be aware that one of Rikulo's design goals is to keep the sphere of API as neat and consistency as possible. Strong enhancement always demands greater consensus.

If you are new to Git or GitHub, please read this guide first.

Who Uses

  • Quire - a simple, collaborative, multi-level task management tool.
  • Keikai - a sophisticated spreadsheet for big data

Categories

Dependencies

Dependency list 2 items

Source repository

Projects using this package