Skip to content

Instantly share code, notes, and snippets.

View chamithchathuka's full-sized avatar
🏠
Working from home

Chamith Chathuka chamithchathuka

🏠
Working from home
View GitHub Profile
public void deepDive(JsonObject members) {
for (Map.Entry<String, JsonElement> entry : members.entrySet()) {
System.out.println("deepDive");
if (entry.getValue().isJsonArray()) {
JsonArray asJsonArray = entry.getValue().getAsJsonArray();
asJsonArray.forEach(jsonElement -> {
deepDive(jsonElement.getAsJsonObject());
});
} else if (entry.getValue().isJsonObject()) {
void main() {
List<String> aListOfStrings = ['one', 'two', 'three'];
List<String> aNullableListOfStrings;
List<String> aListOfNullableStrings = ['one', null, 'three'];
print('aListOfStrings is $aListOfStrings.');
print('aNullableListOfStrings is $aNullableListOfStrings.');
print('aListOfNullableStrings is $aListOfNullableStrings.');
}
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container();
}
}
// Define a function.
void printInteger(int aNumber) {
print('The number is $aNumber.'); // Print to console.
}
// This is where the app starts executing.
void main() {
var number = 42; // Declare and initialize a variable.
printInteger(number); // Call a function.
}
let oVizFrame = that.getView().byId("idcolumn");
let oDataSet = new sap.viz.ui5.data.FlattenedDataset({
dimensions: [
{
name: "Brands",
value: "{Model>Brand}"
}
],
measures: [{
@chamithchathuka
chamithchathuka / schdeuled_notification.dart
Created December 20, 2020 17:36
Flutter Scheduled Notification with a Custom Sound
Future<void> _cancelNotification() async {
await flutterLocalNotificationsPlugin.cancel(0);
}
/// Schedules a notification that specifies a different icon, sound and vibration pattern
Future<void> _scheduleNotification() async {
var scheduledNotificationDateTime =
DateTime.now().add(Duration(seconds: 5));
var vibrationPattern = Int64List(4);
vibrationPattern[0] = 0;
void main() async {
WidgetsFlutterBinding.ensureInitialized(); // add this
await setupRemoteConfig(); // add call to the remote config initalize method method
runApp(GetMaterialApp(
initialRoute: '/page1',
title: '',
theme: ThemeData.light().copyWith(primaryColor: Colors.green),
darkTheme: ThemeData.dark().copyWith(
primaryColor: Colors.purple,
),
@chamithchathuka
chamithchathuka / main.dart
Last active October 30, 2020 08:30
Remote config Method
Future<RemoteConfig> setupRemoteConfig() async {
await Firebase.initializeApp();
final RemoteConfig remoteConfig = await RemoteConfig.instance;
remoteConfig.setConfigSettings(RemoteConfigSettings(debugMode: true));
remoteConfig.setDefaults(<String, dynamic>{
'primary_colour': 0xFFB74093,
'text_body_colour': 0xFFB71000,
'appbar_colour': 0xFFB71000,
'theme': 'system',
'enable_custom_theme': false,
@chamithchathuka
chamithchathuka / main.dart
Created October 30, 2020 03:20
Flutter Firebase Remote Config - Initial
import 'package:flutter/material.dart';
import 'package:get/get.dart';
void main() {
runApp(GetMaterialApp(
initialRoute: '/page1',
title: '',
theme: ThemeData.light().copyWith(primaryColor: Colors.green),
darkTheme: ThemeData.dark().copyWith(primaryColor: Colors.purple,backgroundColor: Colors.black, ),
themeMode: ThemeMode.light,