Skip to content

Instantly share code, notes, and snippets.

import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
parseJson() {
try {
return Login.fromJson(json.decode(result.body));
} on FormatException catch (e) { // catching an exception according to it's type
return Future.error(InvalidDataError(e.message));
} on ParseException {
return Future.error(InvalidDataError());
} catch (_) {
return Future.error(InvalidDataError());
}
class IsolateHolderService : MethodChannel.MethodCallHandler, LocationUpdateListener, Service() {
// ... other code ...
companion object {
private var notificationChannelName = "Flutter Locator Plugin"
private var notificationTitle = "Start Location Tracking"
private var notificationMsg = "Track location in background"
private var notificationBigMsg = "Background location is on to keep the app up-tp-date with your location. This is required for main features to work properly when the app is not running."
// jshint esnext:true
// "use strict";
// esversion: 6
// https://jsbin.com/yujazob/edit?js
// you can see the output in the console (cmd+opt+J)
var config = {
apiKey: "AIzaSyBVF7jKRrkBl22S03aZy_77m0Q9edXccx8",
authDomain: "treckerandroid.firebaseapp.com",
library built_vehicle;
import 'dart:convert';
import 'package:built_collection/built_collection.dart';
import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart';
import 'package:clean_architecture/built_value/serializers.dart';
part 'built_vehicle.g.dart';

Article on hot keys

Ctrl+Alt+O - removing unused imports

Alt+Cmd+V - extracting a variable

Alt+Cmd+C - extracting a constant

Alt+Cmd+M - extracting a method

class TestLocalizationsDelegate
extends LocalizationsDelegate<TestLocalizations> {
const TestLocalizationsDelegate();
@override
bool isSupported(Locale locale) {
return [DE, EN, PL].contains(locale.languageCode);
}
@override
class Application : FlutterApplication() {
override fun onCreate() {
super.onCreate()
LocationService.setPluginRegistrant(object: PluginRegistry.PluginRegistrantCallback {
override fun registerWith(registry: PluginRegistry?) {
registry?.registrarFor("us.kostenko.gps_service_plugin.GpsServicePlugin")?.let {
GpsServicePlugin.registerWith(it)
}
}