This file contains hidden or 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 '/src/config/dio_config.dart'; | |
| import '/src/models/api_response_model.dart'; | |
| import '/src/models/user_model.dart'; | |
| import '/src/utils/constants/constants.dart'; | |
| class UserNetworkService { | |
| Future<ApiResponse<List<UserModel>>> getListOfUsers() async { | |
| try { | |
| var res = await Api().get(); | |
| var apiRes = ApiResponse<List<UserModel>>.fromListJson( |
This file contains hidden or 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:get/get.dart'; | |
| import '/src/backend/api/user_nw_service.dart'; | |
| import '/src/models/user_model.dart'; | |
| class UserListController extends GetxController | |
| with StateMixin<List<UserModel>> { | |
| @override | |
| void onInit() { | |
| super.onInit(); | |
| fetchUsers(); | |
| } |
This file contains hidden or 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:cached_network_image/cached_network_image.dart'; | |
| import 'package:flutter/material.dart'; | |
| import 'package:get/get.dart'; | |
| import '/src/modules/home/user_display_controller.dart'; | |
| class GetXStateMixinDemo extends StatelessWidget { | |
| GetXStateMixinDemo({super.key}); | |
| var c = Get.put(UserListController()); | |
| @override |
This file contains hidden or 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
| { | |
| "s":1, | |
| "m":"Success", | |
| "r":[ | |
| { | |
| "gender": "male", | |
| "name": { | |
| "title": "Mr", | |
| "first": "Oswaldo", | |
| "last": "Hernádez" |
This file contains hidden or 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:convert'; | |
| String apiResponseToJson(ApiResponse data) => json.encode(data.toJson()); | |
| class ApiResponse<T> { | |
| ApiResponse({ | |
| this.s = 0, | |
| this.m = "", | |
| this.r, |
This file contains hidden or 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
| func signUpWith(userName: String, anchor: ASPresentationAnchor) { | |
| self.authenticationAnchor = anchor | |
| let publicKeyCredentialProvider = ASAuthorizationPlatformPublicKeyCredentialProvider(relyingPartyIdentifier: domain) | |
| // Fetch the challenge from the server. The challenge needs to be unique for each request. | |
| // The userID is the identifier for the user's account. | |
| let challenge = Data() | |
| let userID = Data(UUID().uuidString.utf8) | |
| let registrationRequest = publicKeyCredentialProvider.createCredentialRegistrationRequest(challenge: challenge, |
This file contains hidden or 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
| func signInWith(anchor: ASPresentationAnchor, preferImmediatelyAvailableCredentials: Bool) { | |
| self.authenticationAnchor = anchor | |
| let publicKeyCredentialProvider = ASAuthorizationPlatformPublicKeyCredentialProvider(relyingPartyIdentifier: domain) | |
| // Fetch the challenge from the server. The challenge needs to be unique for each request. | |
| let challenge = Data() | |
| let assertionRequest = publicKeyCredentialProvider.createCredentialAssertionRequest(challenge: challenge) | |
| // Also allow the user to use a saved password, if they have one. |
This file contains hidden or 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 AuthenticationServices | |
| import Foundation | |
| import os | |
| extension NSNotification.Name { | |
| static let UserSignedIn = Notification.Name("UserSignedInNotification") | |
| static let ModalSignInSheetCanceled = Notification.Name("ModalSignInSheetCanceledNotification") | |
| } | |
| class AccountManager: NSObject, ASAuthorizationControllerPresentationContextProviding, ASAuthorizationControllerDelegate { | |
| //To setup backend side, https://quickbirdstudios.com/blog/ios-passkeys/ | |
| //Define your connected domain |
This file contains hidden or 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:io'; | |
| import 'package:dio/dio.dart'; | |
| class Api { | |
| final dio = createDio(); | |
| String _token = ""; | |
| String _apiKey = ""; | |
| Api._internal(); |
NewerOlder