This file contains 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'; | |
import 'dart:io'; | |
import 'package:path_provider/path_provider.dart'; | |
import 'dart:convert'; | |
const String kFileName = 'myJsonFile.json'; | |
const InputDecoration kInputDecoration = InputDecoration( | |
border: OutlineInputBorder(), | |
labelText: 'Label Text', | |
); |
This file contains 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
// Call the method e.g. from initState like this: FetchListOfJsonsApi().getDecodedBody(); | |
// | |
// Install the http plugin here: https://pub.dev/packages/http | |
import 'package:http/http.dart' as http; | |
import 'dart:convert'; | |
class FetchListOfJsonsApi { | |
final String url; | |
FetchListOfJsonsApi({ |
This file contains 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
// Call the method e.g. from initState like this: FetchListOfJsonsApi().getDecodedBody(); | |
// | |
// Install the http plugin here: https://pub.dev/packages/http | |
import 'package:http/http.dart' as http; | |
import 'dart:convert'; | |
class FetchListOfJsonsApi { | |
final String url; | |
FetchListOfJsonsApi({ |
This file contains 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'; | |
import 'package:today/globals/constants.dart'; | |
import 'package:today/services/auth_service.dart'; | |
import 'package:today/style/style_constants.dart'; | |
import 'package:device_info_plus/device_info_plus.dart'; | |
import 'dart:io'; | |
import 'package:flutter_email_sender/flutter_email_sender.dart'; | |
import 'package:package_info_plus/package_info_plus.dart'; |
This file contains 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:ambee2/models/animations/light_animation.dart'; | |
import 'package:audio_service/audio_service.dart'; | |
import 'package:flutter/material.dart'; | |
// import 'package:just_audio/just_audio.dart'; | |
import 'package:audioplayers/audioplayers.dart'; | |
// Two lines below: this is how I call the audio to start | |
// await lightAnimation.audioHandler.setRepeatMode(AudioServiceRepeatMode.all); | |
// await lightAnimation.audioHandler.playUrl(lightAnimation.audioUrl, volumeSetValue); |
This file contains 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
Reset: \x1B[0m | |
Cursive: \x1B[3m // new data from db | |
Black: \x1B[30m | |
Red: \x1B[31m // errors | |
Green: \x1B[32m // manager/controller | |
Yellow: \x1B[33m // db data | |
Blue: \x1B[34m // flutter | |
Magenta: \x1B[35m | |
Cyan: \x1B[36m | |
White: \x1B[37m // local helper functions |
This file contains 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
class RomanNumbers { | |
static int romanToDecimal(String romanNumber) { | |
Map<String, int> romanMap = { | |
'I': 1, | |
'V': 5, | |
'X': 10, | |
'L': 50, | |
'C': 100, | |
'D': 500, | |
'M': 1000, |
This file contains 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
class RomanNumbers { | |
int romanCharToInt(String romanChar) { | |
switch (romanChar) { | |
case 'I': | |
return 1; | |
case 'V': | |
return 5; | |
case 'X': | |
return 10; | |
case 'L': |
This file contains 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
WEB CONFIG | |
flavor.dart: | |
``` | |
import 'package:flutter/foundation.dart'; | |
import 'package:flutter_dotenv/flutter_dotenv.dart'; | |
import 'package:package_info_plus/package_info_plus.dart'; | |
import 'package:today/models/enums.dart'; |
This file contains 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
bool isPalindrome(int number) { | |
// Core logic explained on an example 1234 | |
// 1234 == 4321 | |
// old new | |
// Default values | |
// 1234 0 | |
// Loop starts: | |
// 123 4 (0*10 +4) | |
// 12 43 (4*10+3) | |
// 1 432 (43*10 +2) |
OlderNewer