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
void main() { | |
Set<String> smartTags = {}; | |
final List<Product> productsToPullTagsFrom = [ | |
Product(productName: 'Product A', bvTags: ['tag 1']), | |
Product(productName: 'Product B', bvTags: ['tag 2', 'tag 3']), | |
Product(productName: 'Product C', bvTags: ['tag 1', 'tag 3']), | |
Product(productName: 'Product D'), // no tags, and in fact, tags are null | |
Product(productName: 'Product E', bvTags: []), | |
Product(productName: 'Product F', bvTags: ['tag 1', 'tag 2', 'tag 3', 'tag 4']), |
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:provider/provider.dart'; | |
void main() { | |
runApp(const SampleApp()); | |
} | |
class SampleApp extends StatelessWidget { | |
const SampleApp({super.key}); | |
@override |
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
void main() { | |
final String url = "http://www.clickspce.com?foo=bar&fizz=buzz&name=Sebastian"; | |
final Uri parsedUri = Uri.parse(url); | |
print(parsedUri.queryParameters['foo']); | |
print(parsedUri.queryParameters['fizz']); | |
print(parsedUri.queryParameters['name']); | |
print(parsedUri.queryParameters['probably_null']); | |
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 'dart:convert'; | |
import 'package:dart_jsonwebtoken/dart_jsonwebtoken.dart'; | |
import 'package:http/http.dart' as http; | |
const _PATH_TO_SERVICES_JSON = './secrets/service_account.json'; | |
const _GOOGLE_TOKEN_EXCHANGE_URL = 'https://oauth2.googleapis.com/token'; | |
final _cachedToken = <String, DateTime>{}; | |
/// Gets OAuth2.0 access token from a service account json |
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 ProfitekItem { | |
late final bool taxable1; | |
late final bool taxable2; | |
late final bool taxable3; | |
late final bool taxable4; | |
late final num? taxRate1; | |
late final num? taxRate2; | |
late final num? taxRate3; | |
late final num? taxRate4; |
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 'dart:math'; | |
double roundDouble(double value, double places) { | |
num mod = pow(10.0, places); | |
return ((value * mod).round().toDouble() / mod); | |
} | |
extension BetterDoubles on num { | |
num roundAsDoubleBetter(double places) { | |
final num mod = pow(10.0, places); |
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
void main() { | |
ten:while(true) { | |
print('Hello world!'); | |
continue ten; | |
break; | |
} | |
} |
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 'dart:async'; | |
import 'dart:io'; | |
import 'dart:isolate'; | |
void main(List<String> arguments) async { | |
ReceivePort receivePort = ReceivePort(); | |
Isolate fooIsolate = await Isolate.spawn(foo, receivePort.sendPort); | |
Isolate barIsolate = await Isolate.spawn(bar, receivePort.sendPort); | |
Isolate fooBarIsolate = await Isolate.spawn(fooBar, receivePort.sendPort); |
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 "dart:mirrors"; | |
class Product { | |
String type; | |
String brand; | |
String model; | |
Product(this.type, this.brand, this.model); | |
} |
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 Cannabis { | |
final String uom; | |
final num p; | |
Cannabis(this.uom, this.p); | |
} | |
void main() { | |
List<Cannabis> product = [ | |
Cannabis('%', 5), |
NewerOlder