Evaluate Essential Studio for Flutter free.Start building today.
Add Syncfusion Flutter widgets to your app.
Use a package manager to add Syncfusion Flutter widgets to your application now, or download Syncfusion Studio to browse samples and binaries on your desktop.
Install the Flutter DataGrid package
Run the following command in your project’s terminal:
flutter pub add syncfusion_flutter_datagrid
Import the DataGrid library
Add the following import in your Dart file:
import 'package:syncfusion_flutter_datagrid/datagrid.dart';
Initialize the DataGridSource
Define the OrderInfo model class and DataGridSource subclass to provide data to the SfDataGrid:
// Model
class OrderInfo {
OrderInfo({
required this.orderID,
required this.customerName,
required this.shipCity,
});
final int orderID;
final String customerName;
final String shipCity;
}
// ViewModel
class OrderViewModel {
List<OrderInfo> orders = [];
OrderViewModel() {
populateData();
}
void populateData() {
orders.add(OrderInfo(
orderID: 1001,
customerName: 'Nirav Joshi',
shipCity: 'New York',
));
orders.add(OrderInfo(
orderID: 1002,
customerName: 'Jenifer Peacock',
shipCity: 'California',
));
orders.add(OrderInfo(
orderID: 1003,
customerName: 'Michael Shawn',
shipCity: 'New Mexico',
));
}
}
// DataGridSource
class OrderDataSource extends DataGridSource {
OrderDataSource({required List<OrderInfo> orders}) {
_orders = orders;
}
late List<OrderInfo> _orders;
@override
List<DataGridRow> get rows => _orders
.map<DataGridRow>((order) => DataGridRow(cells: [
DataGridCell<int>(columnName: 'OrderID', value: order.orderID),
DataGridCell<String>(columnName: 'CustomerName', value: order.customerName),
DataGridCell<String>(columnName: 'ShipCity', value: order.shipCity),
]))
.toList();
@override
DataGridRowAdapter buildRow(DataGridRow row) {
return DataGridRowAdapter(
cells: row.getCells().map<Widget>((cell) {
return Container(
alignment: Alignment.centerRight,
padding: const EdgeInsets.all(8.0),
child: Text(cell.value.toString()),
);
}).toList(),
);
}
}
Add the SfDataGrid widget
Add the SfDataGrid widget. Use source and columns to bind data and define the column structure.
late OrderDataSource _dataSource;
@override
void initState() {
final orderViewModel = OrderViewModel();
_dataSource = OrderDataSource(orders: orderViewModel.orders);
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: SfDataGrid(
source: _dataSource,
columns: <GridColumn>[
GridColumn(
columnName: 'OrderID',
label: Container(
padding: const EdgeInsets.all(8.0),
alignment: Alignment.centerRight,
child: const Text('Order ID'),
),
),
GridColumn(
columnName: 'CustomerName',
label: Container(
padding: const EdgeInsets.all(8.0),
alignment: Alignment.centerLeft,
child: const Text('Customer Name'),
),
),
GridColumn(
columnName: 'ShipCity',
label: Container(
padding: const EdgeInsets.all(8.0),
alignment: Alignment.centerLeft,
child: const Text('Ship City'),
),
),
],
),
);
}
Search a control. Copy its install command.
Search 245 controls across 14 platforms. Each command comes from that control’s getting-started guide, and every package is checked on NuGet, npm, or pub.dev.
Loading controls…
Evaluate faster with your coding agent.
Paste this prompt into GitHub Copilot, Claude Code, Cursor, or any agent. It sets up Syncfusion for your project from ai.syncfusion.com before it writes code.
Set up this project for Syncfusion before generating code. Fetch and follow the official instructions at https://ai.syncfusion.com then report the detected platform, installed skills, MCP status, and any required licensing action.
No key needed to install the skills. The MCP servers use the API key that comes with a free account. Agent setup guides
AI assistants
IDEs
Short, task-first walkthroughs.
Need help getting started?
Explore our resources or reach out to our support team for assistance.
Syncfusion Studio for your desktop.
One small download. Browse every product, download samples and binaries, and set up your IDE and AI assistant.