Flutter کئی قسم کی testing کو سپورٹ کرتا ہے — unit tests (منطق)، widget tests (UI اجزاء)، اور integration tests (مکمل ایپ کے بہاؤ)۔ ایک اچھی testing کی حکمت عملی قابل اعتماری اور اعتماد میں بہتری لاتی ہے، اور Flutter کے testing ٹولز اسے عملی بناتے ہیں۔
یونٹ ٹیسٹس — منطق کو test کریں
// test pure logic (functions, classes, business logic) — fast, no UI
test('adds two numbers', () {
expect(add(2, 3), 5);
});
test('Cart calculates total', () {
final cart = Cart()..add(Item(price: 10));
expect(cart.total, 10);
});
