✏️ تعديل: property
تعديل محتوى الموضوع
→ رجوع للموضوع
عنوان الموضوع
التصنيف
التاقات (مفصولة بفاصلة)
ملاحظة التعديل (اختياري)
المحتوى
- صح، كل نوع بيانات في Dart (وكتير من اللغات) عنده خصائص (properties) خصوصًا الأنواع المركبة والنصوص، والخصائص دي بتديك معلومات عن القيمة بدون ما تنفّذ دالة. - مثال: `String` فيه `length`, `isEmpty`, `codeUnits`; `List` فيه `length`, `isEmpty`, `first`, `last`; `Map` فيه `keys`, `values`; حتى `int` له `bitLength`. - في Dart الخصائص تُستخدم بدون `()`, أما الدوال (functions/methods) بتجي بين قوسين. - لو عايز نعدّل أو نستعرض خصائص النوع اللي بتشتغل عليه، قولي النوع ونركّز على اللي محتاجه (مثلاً List أو custom class). [[String Functions]] **String Properties** - `length`: number of characters. - `isEmpty` / `isNotEmpty`: whether the string has no text. - `codeUnits`: list of UTF-16 code units. - `runes`: Unicode code points (good for emojis/Arabic). - `hashCode`: machine value for hashing. - `runtimeType`: shows the type (`String`). These are accessed without `()`. Use them when you just need info, not to modify the string. **length vs index** - In a Dart `String`, `length` returns how many characters it holds. - Since indexing starts at `0`, the highest valid index is always `length - 1`. - So when you take any `index` and add `1`, you get the position count from `1` (which matches `length` when you reach the last character). - Example: `"Dart"` has `length == 4`, indexes `0..3`, and `index + 1` turns `3` into `4`. [[Zero‑Indexing System]]
👁️ معاينة فورية
💡 كل بلوك قابل للسحب والترتيب. يدعم
Markdown
:
## عنوان
·
**bold**
·
- قائمة
·
```dart code```
·
[[اسم الموضوع]]
💾 حفظ التعديلات