Skip to content

Instantly share code, notes, and snippets.

View pichillilorenzo's full-sized avatar
🎯
Focusing

Lorenzo Pichilli pichillilorenzo

🎯
Focusing
View GitHub Profile
@pichillilorenzo
pichillilorenzo / FlutterInAppWebView5WebMessageChannelsExample.dart
Created April 9, 2021 19:22
Flutter InAppWebView 5 - Web Message Channels Example
import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
Future main() async {
WidgetsFlutterBinding.ensureInitialized();
if (Platform.isAndroid) {
await AndroidInAppWebViewController.setWebContentsDebuggingEnabled(true);
@pichillilorenzo
pichillilorenzo / FlutterInAppWebView5JavaScriptHandlersExample.dart
Created April 9, 2021 19:20
Flutter InAppWebView 5 - JavaScript Handlers Example
import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
Future main() async {
WidgetsFlutterBinding.ensureInitialized();
if (Platform.isAndroid) {
await AndroidInAppWebViewController.setWebContentsDebuggingEnabled(true);
@pichillilorenzo
pichillilorenzo / InAppWebViewPopupWindowExample.dart
Created June 30, 2020 15:21
InAppWebView - Popup Window Example
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
Future main() async {
WidgetsFlutterBinding.ensureInitialized();
runApp(new MyApp());
}
class MyApp extends StatefulWidget {
@pichillilorenzo
pichillilorenzo / InAppWebViewCustomContextMenuExample.dart
Created June 4, 2020 20:29
InAppWebView - Custom Context Menu Example
import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
Future main() async {
WidgetsFlutterBinding.ensureInitialized();
runApp(MyApp());
}
@pichillilorenzo
pichillilorenzo / InAppWebViewWebRTC.dart
Last active March 1, 2023 10:16
InAppWebView - WebRTC on Android
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:permission_handler/permission_handler.dart';
Future main() async {
WidgetsFlutterBinding.ensureInitialized();
await Permission.camera.request();
await Permission.microphone.request();
@pichillilorenzo
pichillilorenzo / InAppWebViewOnDownloadStartExample.dart
Created June 4, 2020 18:58
InAppWebView - How to enable download files in WebView
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:flutter_downloader/flutter_downloader.dart';
import 'package:path_provider/path_provider.dart';
import 'package:permission_handler/permission_handler.dart';
Future main() async {
WidgetsFlutterBinding.ensureInitialized();
await FlutterDownloader.initialize(
@pichillilorenzo
pichillilorenzo / JavaScriptHandlersExample.dart
Last active June 4, 2020 18:46
InAppWebView - JavaScript Handlers Example
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
Future main() async {
WidgetsFlutterBinding.ensureInitialized();
runApp(new MyApp());
}
class MyApp extends StatefulWidget {
@pichillilorenzo
pichillilorenzo / InAppWebViewSimpleExample.dart
Created June 4, 2020 17:58
InAppWebView Simple Example
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
Future main() async {
WidgetsFlutterBinding.ensureInitialized();
runApp(new MyApp());
}
class MyApp extends StatefulWidget {
@pichillilorenzo
pichillilorenzo / object-mapper.interceptor.ts
Created May 5, 2020 13:00
Jackson-js Node.js + LoopBack 4: object-mapper interceptor
import {ContextTags, globalInterceptor, Interceptor, InvocationContext, InvocationResult, Provider, ValueOrPromise} from '@loopback/context';
import {RestBindings} from '@loopback/rest';
import {JsonParser, JsonStringifier} from 'jackson-js';
import {ClassList, JsonStringifierContext} from 'jackson-js/dist/@types';
import {BookController, WriterController} from '../controllers';
import {ProfileViews} from '../views';
/**
* This class will be bound to the application as an `Interceptor` during
* `boot`
@pichillilorenzo
pichillilorenzo / book.model.ts
Created May 5, 2020 12:58
Jackson-js Node.js + LoopBack 4: Book model
import {belongsTo, Entity, model, property} from '@loopback/repository';
import {JsonBackReference, JsonClassType, JsonFormat, JsonFormatShape, JsonIgnore, JsonProperty, JsonView} from 'jackson-js';
import {Writer, WriterWithRelations} from '.';
import {ProfileViews} from '../views';
@model({settings: {strict: false}})
export class Book extends Entity {
// Define well-known properties here
@property({type: 'number', id: true, generated: false})
@JsonProperty()