Hello Dart team,
I hope you are doing well. I recently encountered an interesting situation while experimenting with encapsulation in Dart, which is one of the fundamental concepts of object-oriented programming. Surprisingly, when I attempted to access private fields and methods, the program did not throw an error. This behavior was consistent not only with private variables but also with private methods.
I conducted this experiment using Flutter in Visual Studio Code, and the program executed and throw errors in accessing private members of the class. However, when I tried the same code in DartPad, the private fields, and methods were accessible.
I have attached a screenshot from DartPad demonstrating my successful access and manipulation of private variables and methods.
Thank you for your attention.
Best regards,
Muhammad Kashif Umar
--
For more ways to connect visit https://dart.dev/community
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/70ab2253-f83c-4af4-ad8a-915d9918f85an%40dartlang.org.
--