Skip to content

Instantly share code, notes, and snippets.

View OmarYehiaDev's full-sized avatar
🔍
Searching for new challenges

Omar Yehia OmarYehiaDev

🔍
Searching for new challenges
View GitHub Profile
@OmarYehiaDev
OmarYehiaDev / main.dart
Created July 30, 2024 02:47
Simple Extractor for `YouTube Video ID` **without** using `RegExp`.
void main() {
final id1 = getVideoIdFromUrl(
"https://www.youtube.com/watch?v=L2XfHREa0j0",
);
final id2 = getVideoIdFromUrl(
"https://youtu.be/wCRw3hgIZv4?si=nMn_fyLz-JFnFypU",
);
print(id1);
Term Description
Entrepreneur A person who starts and runs their own business taking on financial risks in the hope of making a profit.
Startup A newly established business that is still in the early stages of development and growth.
Business Idea A concept for a new product or service that has the potential to be successful in the market.
Business Model A plan that outlines how a business will create & deliver & capture value for its customers.
Minimum Viable Product (MVP) A basic version of a product or service that is used to gather feedback from potential customers before launching a full-scale version.
Pitch Deck A presentation used by entrepreneurs to raise funding from investors.
Funding The money that a business needs to start and grow.
Venture Capital (VC) A type of investment that provides funding to startups and early-stage companies with high growth potential.
Angel Investor An individual who invests in startups and early-stage companies.
@OmarYehiaDev
OmarYehiaDev / api_error_parser.dart
Created July 30, 2023 12:54
Error handling in Flutter
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:flutter/services.dart';
import 'package:laravel_exception/laravel_exception.dart';
import 'error_response.dart';
import 'constants.dart';
import 'enums.dart';
@OmarYehiaDev
OmarYehiaDev / Prefs.dart
Created July 27, 2023 15:26
Shared Prefs
import 'dart:convert';
import 'package:get_it/get_it.dart';
import 'package:shared_preferences/shared_preferences.dart';
abstract class Prefs {
static final serviceLocator = GetIt.instance;
static Future<void> initPrefs() async {
final serviceLocator = GetIt.instance;
SharedPreferences sharedPref = await SharedPreferences.getInstance();
serviceLocator.registerSingleton<SharedPreferences>(sharedPref);
import 'package:flutter/material.dart';
class LoginScreen extends StatefulWidget {
const LoginScreen({super.key});
@override
State<LoginScreen> createState() => _LoginScreenState();
}
class _LoginScreenState extends State<LoginScreen> {
@OmarYehiaDev
OmarYehiaDev / radiobutton_ui.dart
Last active October 5, 2022 21:49
Made a duplicate UI for Radio button
const double outerSize = 20;
const double innerSize = outerSize - 10;
Obx(
() => Stack(
children: [
Icon(
Icons.circle_outlined,
color: AppColors.primary,
size: outerSize,
),
@OmarYehiaDev
OmarYehiaDev / streambuilder.dart
Created May 30, 2022 23:54
StreamBuilder Example
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key}) : super(key: key);
@override
Future<void> openOffersPage(RemoteMessage? message) async {
if (message != null) {
if (message.data['type'] == 'offers') {
Navigator.push(
key.currentContext!,
MaterialPageRoute(
builder: (_) => HotOffers(),
),
);
}
Widget build(BuildContext context) {
UserDetails _user = widget.user;
double width = MediaQuery.of(context).size.width;
double height = MediaQuery.of(context).size.height;
return Scaffold(
appBar: AppBar(
title: Text("Profile Page"),
centerTitle: true,
),
body: ListView(
@OmarYehiaDev
OmarYehiaDev / MainActivity.kt
Created February 18, 2021 18:23
This is the native code for creating MethodChannel for Notifications in Flutter
package com.example.app
import androidx.annotation.NonNull
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel
import android.content.Context
import android.content.ContextWrapper
import android.content.Intent
import android.content.IntentFilter