server_table 1.1.0 copy "server_table: ^1.1.0" to clipboard
server_table: ^1.1.0 copied to clipboard

Backend-agnostic Flutter data table with server-side pagination, search, sorting, filtering, configurable response mapping, OData support, and custom REST query serializers.

Server Table #

A backend-agnostic Flutter data table for server-side pagination, search, sorting and filtering. Works with OData, REST APIs, and any custom backend through configurable query serializers and response mapping.


Features #

  • ✅ Backend agnostic
  • ✅ OData support
  • ✅ REST API support
  • ✅ Custom REST query serializers
  • ✅ Server-side pagination
  • ✅ Server-side search
  • ✅ Server-side sorting
  • ✅ Server-side filtering
  • ✅ Configurable backend capabilities
  • ✅ Configurable response mapping
  • ✅ Generic DataSource
  • ✅ Dio integration
  • ✅ Custom loading, empty and error states
  • ✅ Custom row builders
  • ✅ Custom column builders
  • ✅ Type-safe models

Backend Support #

Server Table does not require a specific backend.

You can use it with:

  • OData services
  • ASP.NET APIs
  • Laravel APIs
  • Spring Boot APIs
  • Express.js
  • Node.js
  • NestJS
  • Django
  • FastAPI
  • Any custom REST API

Simply provide the appropriate query serializer and response mapping.

Installation #

Add the package to your pubspec.yaml.

dependencies:
  server_table: ^1.0.0

Then run:

flutter pub get

Create a Dio client #

final dioClient = DioClient(
  baseUrl: 'https://api.example.com',
);

dioClient.setAuthorization(token);

class MyCompanySerializer extends RestQuerySerializer { @override Map<String, String> serialize(QueryOptions options) { return { 'page': '${options.page}', 'size': '${options.pageSize}', if (options.search != null) 'keyword': options.search!, }; } }


Create a DataSource #

final customerSource = DataSource<Customer>(
  client: dioClient,
  endpoint: '/customers',
  fromJson: Customer.fromJson,
  responseConfig: const ResponseConfig(
    itemsPath: 'data.items',
    totalCountPath: 'data.totalCount',
  ),
  capabilities: const BackendCapabilities(
    search: true,
    sorting: false,
    filtering: false,
  ),
  queryBuilder: RestQueryBuilder(
  config: QueryConfig(
    page: 'pageNumber',
    pageSize: 'pageSize',
    search: 'query',
  ),
),
queryBuilder: RestQueryBuilder(
  serializer: MyCompanySerializer(),
)
);

Create a Controller #

final controller = ServerTableController<Customer>(
  dataSource: customerSource,
);

Define Columns #

final columns = [

  ServerColumn<Customer>(
    title: 'Name',
    field: 'name',
    sortable: true,
    filterable: true,
    cellBuilder: (context, customer) {
      return Text(customer.name);
    },
  ),

];

Display the Table #

ServerTable<Customer>(
  controller: controller,
  columns: columns,
)

Response Mapping #

Every API returns data differently.

Configure the response once using ResponseConfig.

Example:

{
  "data": {
    "items": [],
    "totalCount": 100
  }
}

Configuration:

ResponseConfig(
  itemsPath: 'data.items',
  totalCountPath: 'data.totalCount',
)

Built-in Features #

  • Server pagination
  • Multi-column configuration
  • Server sorting
  • Server filtering
  • Horizontal scrolling
  • Loading state
  • Error state
  • Empty state

Why Server Table? #

Unlike traditional data tables, Server Table delegates data operations to your backend.

  • No client-side filtering
  • No client-side sorting
  • No client-side pagination
  • Works with large datasets
  • Works with any backend

Requirements #

Flutter 3.35+


License #

MIT

Update installation #

dependencies: server_table: ^1.1.0

5
likes
150
points
168
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Backend-agnostic Flutter data table with server-side pagination, search, sorting, filtering, configurable response mapping, OData support, and custom REST query serializers.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

collection, dio, flutter

More

Packages that depend on server_table