View elevated_btn.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ElevatedButton( | |
style: ElevatedButton.styleFrom( | |
elevation: 0, | |
primary: primaryColor, | |
minimumSize: const Size(double.infinity, 50), | |
shape: RoundedRectangleBorder( | |
borderRadius: BorderRadius.circular(10.0), | |
), | |
), | |
child: Text( |
View cascade.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
Student() | |
..name = 'Alice' | |
..id = 'A01' | |
..method1() | |
..method2(); | |
} |
View main.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
Student student = Student(); | |
student.name='Alice'; | |
student.id='A01'; | |
student.method1(); | |
student.method2(); | |
} |
View data.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Student { | |
String? name; | |
String? id; | |
void method1() { | |
debugPrint('This is method 1. Name: $name'); | |
} | |
void method2() { | |
debugPrint('This is method 2. ID: $id'); |
View ui.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import '../../../../Data/Models/home_page_model.dart'; | |
import '../../../../Data/Repository/home_page_repo.dart'; | |
import 'package:flutter/material.dart'; | |
class MyHomePage extends StatefulWidget { | |
const MyHomePage({Key? key, required this.title}) : super(key: key); | |
final String title; |
View repo.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter_dotenv/flutter_dotenv.dart'; | |
import '../API/base_client.dart'; | |
import '../Models/home_page_model.dart'; | |
abstract class DemoRepository { | |
Future<DemoModel> fetchData(); | |
} | |
class DemoRepo extends DemoRepository { |
View exception_handlers.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
import 'dart:io'; | |
class ExceptionHandlers { | |
getExceptionString(error) { | |
if (error is SocketException) { | |
return 'No internet connection.'; | |
} else if (error is HttpException) { | |
return 'HTTP error occured.'; | |
} else if (error is FormatException) { |
View base_client.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
import 'dart:convert'; | |
import 'package:http/http.dart' as http; | |
import '../../Business_Logic/Exceptions/exception_handlers.dart'; | |
class BaseClient { | |
static const int timeOutDuration = 35; |
View sendOTP.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sendOTP(String phoneNumber) async { | |
this.phoneNumber = phoneNumber; | |
FirebaseAuth auth = FirebaseAuth.instance; | |
ConfirmationResult confirmationResult = await auth.signInWithPhoneNumber( | |
'+91 $phoneNumber', | |
); | |
printMessage("OTP Sent to +91 $phoneNumber"); | |
return confirmationResult; | |
} |
View validateOTP.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
authenticateMe(ConfirmationResult confirmationResult, String otp) async { | |
UserCredential userCredential = await confirmationResult.confirm(otp); | |
userCredential.additionalUserInfo!.isNewUser | |
? printMessage("Successful Authentication") | |
: printMessage("User already exists"); | |
} |