Skip to main content

Posts

Showing posts from November, 2023

How to create Singleton class and Setter , Getter in dart language

 Singleton class And Setter, Getter // This is the main () function  void main() {   // This constructor calls the factory constructor,   // which turns around and returns the static instance   // which was initialized with the `_internal` named constructor   //This will be true if the two instances have the same hashcode   // (hint: they do)   print(Student().hashCode == Student().hashCode);   //*****************************************   // Create an object of Student class   Student st =  Student();   // setting values to the object using a setter   st.firstName = "Surya Prakash";   st.lastName = "Yadav";   st.age = 28;   // Display the values of the object   print("Full Name: ${st.fullName}");   print("Age: ${st.age}"); } // Create Student Class //**************************************************************************** class Student {      //Create singleton construct...