Skip to content

Instantly share code, notes, and snippets.

View isaacadariku's full-sized avatar
👨‍💻
Focusing

Eternity (Isaac Adariku) isaacadariku

👨‍💻
Focusing
View GitHub Profile
@isaacadariku
isaacadariku / main.dart
Last active March 6, 2023 14:12
Animated Validation
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
const kGap = SizedBox(height: 40);
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
@isaacadariku
isaacadariku / Calling 5 endpoints in Stacked BaseViewModel
Last active July 14, 2022 23:13
A sample of calling several endpoints with Stacked BaseViewModel
const String _endpoint1BusyKey = 'endpoint1Busy';
const String _endpoint2BusyKey = 'endpoint2Busy';
const String _endpoint3BusyKey = 'endpoint3Busy';
const String _endpoint4BusyKey = 'endpoint4Busy';
const String _endpoint5BusyKey = 'endpoint5Busy';
class EndpointViewmodel extends BaseViewModel {
final _endpointService = EndpointService();
// Values of the busy state of the endpoints.
@isaacadariku
isaacadariku / main.dart
Created May 4, 2022 14:32
Keeping your code dry
// Let's have two creature classes,
// each of them with their own set of behaviours.
// The obvious solution would be to directly outline the methods
// for each class as we need them ...
class Alligator {
void swim() => print('Swimming');
void bite() => print('Biting');
void hunt() {
@isaacadariku
isaacadariku / main.dart
Last active April 24, 2022 14:26
Grading system
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@isaacadariku
isaacadariku / main.dart
Created April 19, 2022 07:23
Balance Diets
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
@isaacadariku
isaacadariku / main.dart
Last active February 1, 2022 10:46
Dynamic programming for fibonacci
void main() {
int i = 150;
final fib = fibonacciWithDynamicProgramming();
print('fibonacciWithDynamicProgramming($i) = ${fib(i)}');
print('fibonacci($i) = ${fibonacci(i)}'); //Uncomment this to try large numbers
}
/// Computes the nth Fibonacci number.
@isaacadariku
isaacadariku / main.dart
Created January 24, 2022 23:36
A check container with populated list
import 'package:flutter/material.dart';
void main() {
runApp(Amenities());
}
class CheckContainerModel {
final String title;
bool isCheck;
@isaacadariku
isaacadariku / main.dart
Last active January 24, 2022 23:15
A checked container that checked when tap
import 'package:flutter/material.dart';
void main() {
runApp(Amenties());
}
class CheckContainer extends StatefulWidget {
const CheckContainer({Key? key, this.title = ''}) : super(key: key);
final String title;
@isaacadariku
isaacadariku / main.dart
Created July 14, 2021 00:43
A gist to separate list into chucks of list
void main() {
// Generate List of numbers
List numbers = List<int>.generate(20, (index) => index);
int length = numbers.length;
int split = 2;
List chunks = [];
for (int i = 0; i < length; i += split) {
var end = (i + split < length) ? i + split : length;
@isaacadariku
isaacadariku / main.dart
Last active October 7, 2022 15:58
This gist is a solution to the comment Image below.
import 'dart:math' as math;
void main() {
final Circle c1 = Circle.all(color: 'blue', radius: 2.0);
c1.getRadius();
c1.getColor();
c1.getArea();
final Circle c2 = Circle.radius(radius: 2.0);
c2.getRadius();