Skip to content

Instantly share code, notes, and snippets.

View Zfinix's full-sized avatar
💭
Preaching, Teaching and living the Flutter Fire

Chiziaruhoma Ogbonda Zfinix

💭
Preaching, Teaching and living the Flutter Fire
View GitHub Profile
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:quill/core/model.dart';
import 'package:quill/core/providers/api_provider.dart';
import 'package:quill/widgets/touchable_opacity.dart';
class HomePage extends StatefulHookConsumerWidget {
const HomePage({super.key});
import 'package:quill/core/model.dart';
import 'package:http/http.dart' as http;
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'api_provider.g.dart'; // part of code used with dart:build to generate the api_provider.g.dart file
@riverpod // this function is a provider
Future<QuillBotModel> fetchQuillMessage(
FetchQuillMessageRef ref, {
// message to be sent to the quillbot api
import 'package:dart_frog/dart_frog.dart';
import 'package:tweety/tweety_core.dart';
Handler middleware(Handler handler) {
final tweetyCore = TweetyCore();
return handler.use(provider<TweetyCore>((context) => tweetyCore));
}
import 'package:puppeteer/puppeteer.dart';
import 'package:puppeteer/src/devices.dart';
/// TweetyCore provides access to puppeteer apis and
class TweetyCore {
/// A puppeteer [Browser] instance.
late Browser browser;
/// A puppeteer [Page] instance.
late Page page;
import 'dart:io';
import 'package:dart_frog/dart_frog.dart';
/// Handle Errors from Requests
Future<Response> requestHandler(
Future<Response?> Function() handler,
) async {
try {
return (await handler()) ?? Response.json(body: {});
} catch (e) {
import 'dart:io';
import 'package:dart_frog/dart_frog.dart';
import 'package:tweety/request_handler.dart';
import 'package:tweety/tweety_core.dart';
Future<Response> onRequest(RequestContext context) async {
return requestHandler(
() async {
final param = context.request.uri.queryParameters.entries.first;
import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
enum GraphObjType { square, rect }
class GraphObj {
const GraphObj({
required this.offset,
required this.type,
});
import 'package:http/http.dart';
import 'package:lock/contracts/Lock.g.dart';
import 'package:web3dart/web3dart.dart';
void main(List<String> args) async {
const rpcUrl = 'http://127.0.0.1:8545';
final client = Web3Client(rpcUrl, Client());
final credentials = EthPrivateKey.fromHex(
'0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80', /// This is generated by hardhat, not a real account
import { ethers } from "hardhat";
async function main() {
const currentTimestampInSeconds = Math.round(Date.now() / 1000);
const ONE_YEAR_IN_SECS = 365 * 24 * 60 * 60;
const unlockTime = currentTimestampInSeconds + ONE_YEAR_IN_SECS;
const lockedAmount = ethers.utils.parseEther("1");
const Lock = await ethers.getContractFactory("Lock");
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;
// Import this file to use console.log
import "hardhat/console.sol"; /// remove this if you are not using hardhat
contract Lock {
uint public unlockTime;
address payable public owner;