Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Never Settle

Pedro Lemos pedrolemoz

🎯
Never Settle
View GitHub Profile
View credit_card_validator.dart
extension Validator on String {
String isValid() {
final parsedValue = int.tryParse(this);
switch (parsedValue) {
case 22:
return 'Invalid';
default:
return 'Unknown';
}
@pedrolemoz
pedrolemoz / auto_formatter.dart
Created Oct 10, 2020
Auto formatter for Dart Files within a Flutter project
View auto_formatter.dart
import 'dart:io';
/*
Author: Pedro Lemos
Email: lemozxpedro@gmail.com
Created in: 10/10/2020 @ 12:36 PM
*/
class AutoFormatter {
static void formatAllDartFiles({
@pedrolemoz
pedrolemoz / media_files_handler.dart
Last active May 2, 2020
Media files handler in Dart
View media_files_handler.dart
// Add this two permissions in android/app/src/main/AndroidManifest.xml, being a direct child of <manifest> tag
// <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
// <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
class MediaFilesHandler {
static Iterable<FileSystemEntity> getAllMediaFiles({
@required String fileExtension,
@required String rootPath,
}) {
@pedrolemoz
pedrolemoz / FlutterCommands.md
Last active Oct 14, 2020
Useful commands for Flutter development
View FlutterCommands.md

Create a new Flutter project from command line

flutter create --org "com.pedrolemoz" -a kotlin --androidx -i swift --description "Description" project_name_with_underscores

Switch between channels

flutter channel stable (or beta, dev, master)
flutter upgrade
@pedrolemoz
pedrolemoz / magic_magnet.dart
Last active Jul 5, 2020
Magic Magnet in Dart
View magic_magnet.dart
import 'package:http/http.dart' as http;
import 'package:html/parser.dart';
class MagicMagnet {
Map _magnetLinks = {};
Future<Map> search(String searchContent,
{bool google = true,
bool tpb = false,
bool l337x = false,
@pedrolemoz
pedrolemoz / LinearGradient.dart
Last active Feb 23, 2020
Linear gradient with stops in Flutter
View LinearGradient.dart
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
You can’t perform that action at this time.