Skip to content

Instantly share code, notes, and snippets.

View Laebrye's full-sized avatar

Dave Brealey Laebrye

View GitHub Profile
@Laebrye
Laebrye / main.dart
Created August 2, 2023 11:15
jade-crest-7634
void main() {
print(integralPart(2499,2));
print(fractionalPart(2499,2));
}
String? integralPart(int? centAmount, int? fractionDigits) {
final cent = ((centAmount?.toString().length ?? 0) - (fractionDigits ?? 0));
return centAmount?.toString().substring(0, cent >= 0 ? cent : null);
}
@Laebrye
Laebrye / platform_alert_dialog.dart
Created June 22, 2020 08:23
Platform specific dialog flow widget
import 'dart:io';
import 'package:blockmark_test/ui/common_widgets/platform_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
class PlatformAlertDialog extends PlatformWidget {
PlatformAlertDialog({
@required this.title,
@Laebrye
Laebrye / firestore_service.dart
Created May 19, 2020 09:17
A FirestoreService class - heavily influenced by Andrea Bizzotto's excellent courses
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/foundation.dart';
import 'package:rxdart/rxdart.dart';
class FirestoreService {
FirestoreService._();
static final instance = FirestoreService._();
CollectionReference collectionReference(String path) {