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
| extension NumberExtension on num { | |
| /// This method is used to take the first [count] digits of the number. | |
| /// | |
| /// if the number is 59342394234 and [count] is 2, the result will be 59. | |
| /// number less than [count] will return 0. | |
| num takeDigits(int count) { | |
| final value = toString(); | |
| final isValueLengthValid = value.length >= count; | |
| if (!isValueLengthValid) return 0; | |
| return num.parse(value.substring(0, count)); |
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:flutter/material.dart'; | |
| import 'package:vbaseproject/features/v2/demo/home_veli_view.dart'; | |
| mixin HomeVeliMixin on State<HomeVeliView> { | |
| void showErrorMessage(); | |
| void fetchUserDeteail({required String id}) { | |
| const response = true; | |
| if (!response) return; | |
| showErrorMessage(); |
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
| final class NetworkManager: NetworkManagerCore { | |
| var config: NetworkConfig = .init(baseUrl: "") | |
| /// Send your request without model paramaters | |
| /// - Parameters: | |
| /// - path: NetworkPath value | |
| /// - method: HTTPMethod value | |
| /// - type: Decoded model | |
| /// - Returns: Success encoded model or | |
| func send<T: Decodable>(path: NetworkPath, method: HTTPMethod, type: T.Type) async -> Result<T?, Error> { |
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
| extension FutureExtension<T> on Future<T> { | |
| Future<T?> timeoutOrNull({ | |
| Duration timeOutDuration = const Duration(seconds: 10), | |
| bool enableLogger = true, | |
| }) async { | |
| try { | |
| final response = await timeout(timeOutDuration); | |
| return response; | |
| } catch (e) { | |
| if (enableLogger) CustomLogger.log('$T $e'); |
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
| extension IterableExtension<T> on Iterable<T?> { | |
| List<T> makeSafe() { | |
| return where((element) => element != null).cast<T>().toList(); | |
| } | |
| } | |
| class VB10ViewModel { | |
| List<User> dummyListToSafe() { | |
| final userList = <User?>[ | |
| const User(), |
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
| extension on String { | |
| /// Decode your [jsonString] value with safety | |
| Future<dynamic> safeJsonDecodeCompute() async { | |
| try { | |
| return await compute<String, dynamic>( | |
| jsonDecode, | |
| this, | |
| ); | |
| } catch (e) { | |
| Logger().e('Json decode error'); |
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
| "explorer.fileNesting.patterns": { | |
| "pubspec.yaml": ".flutter-plugins, .packages, .dart_tool, .flutter-plugins-dependencies, .metadata, .packages, pubspec.lock, build.yaml, analysis_options.yaml, all_lint_rules.yaml", | |
| ".gitignore": ".gitattributes, .gitmodules, .gitmessage, .mailmap, .git-blame*", | |
| "readme.*": "authors, backers.md, changelog*, citation*, code_of_conduct.md, codeowners, contributing.md, contributors, copying, credits, governance.md, history.md, license*, maintainers, readme*, security.md, sponsors.md", | |
| "*.dart": "$(capture).g.dart, $(capture).freezed.dart", | |
| }, | |
| "[dart]": { | |
| "editor.formatOnSave": true, | |
| "editor.formatOnType": true, | |
| "editor.rulers": [ |
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
| extension IntExtension on int? { | |
| StatusCode get httpStatusCode { | |
| if (this == null) return StatusCode.unknown; | |
| switch (this!) { | |
| case < 200: | |
| return StatusCode.continue_; | |
| case >= 200 && <= 300: | |
| return StatusCode.ok; | |
| case 401: |
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 requests | |
| import json | |
| # GitHub API'ya gönderilecek olan veriler | |
| base_url = "https://api.github.com/repos/{owner}/{repo}" | |
| owner = "vb10" | |
| repo = "2023-staj" | |
| comment_body = f"""Merhaba arkadaşlar, sizler için elimden geldiğince herkese yazdım, LinkedIn postları paylaştım ve elimden gelen bir çok arkadaşa erişip staj bulmasına yardımcı oldum. Bu saate kadar size verebileceğim 'ben olsaydım' diyeceğim: | |
| - Bu repoyu LinkedIn'de paylaşıp sadece kendim için değil, benim gibi arkadaşlar için staj arıyoruz demeniz. |
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
| class _LoginViewState extends State<LoginView> with LoginController { | |
| late final ClearTextAction textAction; | |
| late final ControllerCleaner _controllerCleaner; | |
| String _value = ''; | |
| @override | |
| void initState() { | |
| super.initState(); | |
| textAction = ClearTextAction(); | |
| _controllerCleaner = ControllerCleaner(textAction); | |
| } |