من الدليل الجذر لمشروع Flutter، شغِّل الأمر التالي لتثبيت المكوّن الإضافي Performance Monitoring Flutter:
flutterpubaddfirebase_performance
من الدليل الجذر لمشروع Flutter، نفِّذ الأمر التالي:
flutterfireconfigure
يضمن تنفيذ هذا الأمر أنّ إعدادات Firebase لتطبيق Flutter محدّثة، كما يضيف إلى تطبيقك المكوّن الإضافي Gradle المطلوب في Performance Monitoring على Android.
بعد اكتمال العملية، أعِد إنشاء مشروع Flutter باتّباع الخطوات التالية:
flutterrun
بعد إضافة حزمة تطوير البرامج (SDK) الخاصة بخدمة Performance Monitoring، يبدأ Firebase تلقائيًا في جمع البيانات المتعلّقة بدورة حياة تطبيقك (مثل وقت بدء تشغيل التطبيق) وبيانات طلبات شبكة HTTP/S.
في Flutter، لا يمكن مراقبة أداء العرض التلقائي للشاشة
لشاشات Flutter الفردية. يغلف عنصر تحكّم واحد في العرض تطبيق Flutter بأكمله بشكل أصلي، وبالتالي لا تكون حزمة تطوير البرامج (SDK) الأصلية الأساسية لمنصة Firebase على دراية بعمليات الانتقال بين الشاشات.
الخطوة 2: إنشاء أحداث الأداء لعرض البيانات الأوّلية
يبدأ Firebase في معالجة الأحداث عند إضافة حزمة تطوير البرامج (SDK) إلى تطبيقك بنجاح. وإذا كنت لا تزال في مرحلة التطوير على جهازك، تفاعَل مع تطبيقك لإنشاء أحداث من أجل جمع البيانات ومعالجتها في البداية.
واصِل تطوير تطبيقك باستخدام محاكي أو جهاز اختباري.
يمكنك إنشاء أحداث من خلال التبديل بين تشغيل تطبيقك في الخلفية وفي المقدّمة عدة مرات، والتفاعل مع تطبيقك من خلال التنقّل بين الشاشات، و/أو تشغيل طلبات الشبكة.
انتقِل إلى لوحة بيانات الأداء في "وحدة تحكّم Firebase". من المفترض أن تظهر لك البيانات الأولية في غضون بضع دقائق.
باستخدام تتبُّع الرموز المخصّصة، يمكنك قياس المدة التي يستغرقها تطبيقك لإكمال مهمة معيّنة أو مجموعة من المهام، مثل تحميل مجموعة من الصور أو طلب البحث من قاعدة البيانات. المقياس التلقائي لتتبُّع الرمز المخصّص هو مدته، ولكن يمكنك أيضًا إضافة مقاييس مخصّصة، مثل عدد مرات الوصول إلى ذاكرة التخزين المؤقت وتحذيرات الذاكرة.
في الرمز البرمجي، يمكنك تحديد بداية ونهاية عملية تتبُّع رمز مخصّص (وإضافة أي مقاييس مخصّصة مرغوبة) باستخدام واجهة برمجة التطبيقات التي توفّرها حزمة تطوير البرامج (SDK) الخاصة بخدمة Performance Monitoring.
انتقِل إلى إضافة مراقبة لرمز معيّن
للاطّلاع على مزيد من المعلومات حول هذه الميزات وكيفية إضافتها إلى تطبيقك.
الخطوة 5: نشر تطبيقك ثم مراجعة النتائج
بعد التحقّق من صحة أداة "مراقبة الأداء" باستخدام محاكي وجهاز اختبار واحد أو أكثر، يمكنك نشر الإصدار المعدَّل من تطبيقك للمستخدمين.
يمكنك مراقبة بيانات الأداء في لوحة بيانات الأداء في وحدة تحكّم Firebase.
الخطوات التالية
مزيد من المعلومات عن البيانات التي يجمعها تلقائيًا منتج Performance Monitoring:
تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["\u003cbr /\u003e\n\nThis quickstart describes how to set up Firebase Performance Monitoring to help\nyou to gain insight into the performance characteristics of your Flutter apps.\n\nBefore you begin\n\nIf you haven't already,\n[configure and initialize Firebase](/docs/flutter/setup) in your Flutter\nproject.\n\n**Step 1**: Add Performance Monitoring to your app\n\n1. From the root directory of your Flutter project, run the following\n command to install the Performance Monitoring Flutter plugin:\n\n flutter pub add firebase_performance\n\n2. From the root directory of your Flutter project, run the following command:\n\n flutterfire configure\n\n Running this command ensures that your Flutter app's Firebase configuration\n is up-to-date and, for Android, adds the required Performance Monitoring\n Gradle plugin to your app.\n3. Once complete, rebuild your Flutter project:\n\n flutter run\n\nAfter you've added the Performance Monitoring SDK, Firebase automatically starts collecting\ndata related to your app's lifecycle (like\n[app start time](/docs/perf-mon/app-start-foreground-background-traces)), and\ndata for [HTTP/S network requests](/docs/perf-mon/network-traces).\n\nOn Flutter, automatic screen rendering performance monitoring is not possible\nfor individual Flutter screens. A single view controller encapsulates your\nentire Flutter application natively so the underlying native Firebase SDK is\nnot aware of screen transitions.\n| **Note:** When you add Performance Monitoring to your app, the Remote Config SDK is included as a dependency. If you already use Remote Config, you won't see any difference. However, if you're new to Remote Config, explore the [Remote Config documentation](/docs/remote-config) to learn more about the various features you'll be able to access in your app.\n\n**Step 2**: Generate performance events for initial data display\n\nFirebase starts processing the events when you successfully add the SDK to your\napp. If you're still developing locally, interact with your app to generate\nevents for initial data collection and processing.\n| **Note:** The Performance Monitoring SDK batches events locally then sends them to Firebase periodically (every 30 seconds) or when the app comes back to foreground. So, there's a delay between an app interaction and when Firebase receives the event information from your app.\n\n1. Continue to develop your app using a simulator or test device.\n\n2. Generate events by switching your app between background and foreground\n several times, interacting with your app by navigating across screens,\n and/or triggering network requests.\n\n3. Go to the [*Performance* dashboard](//console.firebase.google.com/project/_/performance)\n of the Firebase console. You should see your initial data display within\n a few minutes.\n\n If you don't see a display of your initial data, review the [troubleshooting\n tips](/docs/perf-mon/troubleshooting?platform=ios#sdk-detected-no-data).\n\n**Step 3** : *(Optional)* View log messages for performance events\n\n1. Check your log messages for any error messages.\n\n Performance Monitoring tags its log messages with the following tags so that\n you can filter your log messages:\n - iOS+: `Firebase/Performance`\n - Android: `FirebasePerformance`\n2. Check for the following types of logs which indicate that Performance Monitoring is\n logging performance events:\n\n - `Logging trace metric: `\u003cvar translate=\"no\"\u003eTRACE_NAME\u003c/var\u003e`, `\u003cvar translate=\"no\"\u003eFIREBASE_PERFORMANCE_CONSOLE_URL\u003c/var\u003e\n - `Logging network request trace: `\u003cvar translate=\"no\"\u003eURL\u003c/var\u003e\n3. Click on the URL to view your data in the Firebase console. It may take a few\n moments for the data to update in the dashboard.\n\n**Step 4** : *(Optional)* Add custom monitoring for specific code\n\nTo monitor performance data associated with specific code in your app, you can\ninstrument [**custom code traces**](/docs/perf-mon/custom-code-traces?platform=flutter).\n\nWith a custom code trace, you can measure how long it takes your app to complete\na specific task or set of tasks, such as loading a set of images or querying\nyour database. The default metric for a custom code trace is its duration, but\nyou can also add custom metrics, such as cache hits and memory warnings.\n\nIn your code, you define the beginning and the end of a custom code trace (and\nadd any desired custom metrics) using the API provided by the Performance Monitoring SDK.\n\nVisit [Add monitoring for specific code](/docs/perf-mon/custom-code-traces?platform=flutter)\nto learn more about these features and how to add them to your app.\n\n**Step 5**: Deploy your app then review results\n\nAfter you've validated Performance Monitoring using the an emulator and one or more\ntest devices, you can deploy the updated version of your app to your users.\n\nYou can monitor performance data in the\n[*Performance* dashboard](//console.firebase.google.com/project/_/performance)\nof the Firebase console.\n\nNext steps\n\n- Learn more about data automatically collected by Performance Monitoring:\n\n - Data related to your app's lifecycle, like [app start time](/docs/perf-mon/app-start-foreground-background-traces)\n - Data for [HTTP/S network requests](/docs/perf-mon/network-traces) issued by your app\n- [View, track, and filter](/docs/perf-mon/console) your\n performance data in the Firebase console.\n\n- Add monitoring for specific tasks or workflows in your app by\n [instrumenting custom code traces](/docs/perf-mon/custom-code-traces?platform=flutter).\n\n- [Use attributes to filter performance data](/docs/perf-mon/attributes)."]]