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:flutter/services.dart'; | |
import 'package:flutter_jailbreak_detection/flutter_jailbreak_detection.dart'; | |
Future<bool> checkJailbrokenOrRooted() async { | |
bool jailbrokenOrRooted = true; | |
try { | |
if (Platform.isAndroid) { | |
jailbrokenOrRooted = await FlutterJailbreakDetection.developerMode; |
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
<key>NSAppTransportSecurity</key> | |
<dict> | |
<key>NSExceptionDomains</key> | |
<dict> | |
<key>ryandsilva.dev</key> | |
<dict> | |
<!--Include to allow subdomains--> | |
<key>NSIncludesSubdomains</key> | |
<true/> | |
<!--Include to allow HTTP requests--> |
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
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="dev.ryandsilva.flutter_app"> | |
<application | |
android:label="flutter_app" | |
android:name="${applicationName}" | |
android:icon="@mipmap/ic_launcher" | |
android:networkSecurityConfig="@xml/security_config"> | |
... | |
... |
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:flutter/material.dart'; | |
import 'package:flutter/services.dart'; | |
import 'package:http/io_client.dart'; | |
Future<SecurityContext> get globalContext async { | |
final sslCert = await rootBundle.load('assets/certs/ryandsilva-dev.pem'); | |
final sc = SecurityContext(withTrustedRoots: false); | |
sc.setTrustedCertificatesBytes(sslCert.buffer.asInt8List()); |
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_secure_storage/flutter_secure_storage.dart'; | |
Future<void> secureStorageActions() async { | |
// Create storage | |
const storage = FlutterSecureStorage(); | |
// Read value | |
String? value = await storage.read(key: 'key'); | |
// Read all values |
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
return MaterialApp( | |
title: 'Flutter App', | |
builder: (context, widget) { | |
ErrorWidget.builder = (FlutterErrorDetails errorDetails) { | |
return CustomErrorWidget(errorDetails: errorDetails); | |
}; | |
return widget ?? const Scaffold(); | |
}, | |
... | |
... |
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'; | |
Future<dynamic> functionThatThrowsException() async { | |
// some code | |
throw Exception('Could not perform operation.'); | |
} | |
Future<void> testFunction() async { | |
try { | |
var x = await functionThatThrowsException(); |
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
service: aws-step-functions | |
variablesResolutionMode: 20210326 | |
provider: | |
name: aws | |
stage: ${opt:stage, 'dev'} | |
# profile: profile-name | |
region: eu-west-1 | |
runtime: nodejs14.x |
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
pre-commit: | |
commands: | |
lint_code: | |
glob: '*.dart' | |
run: dart fix lib && git add . | |
format_code: | |
glob: '*.dart' | |
run: flutter format {staged_files} && git add . | |
pre-push: |
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:dio/dio.dart'; | |
class ApiBaseHelper { | |
static final String url = 'BASE_URL'; | |
static BaseOptions opts = BaseOptions( | |
baseUrl: url, | |
responseType: ResponseType.json, | |
connectTimeout: 30000, | |
receiveTimeout: 30000, | |
); |
NewerOlder