Skip to content

Instantly share code, notes, and snippets.

View Mark-RSK's full-sized avatar

Mark Pitt Mark-RSK

View GitHub Profile
@Mark-RSK
Mark-RSK / switchOnType.dart
Created March 9, 2021 19:20
Dart switch on type
class Cat {
String meow() => 'meow';
}
String foo(dynamic a) {
switch (a.runtimeType) {
case String:
return 'str';
case int:
return 'int';
private static IRenderService CreateJsReportInstance(bool useWeb)
{
IReportingBinary binary = null;
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
binary = jsreport.Binary.Ph2.JsReportBinary.GetBinary();
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
binary = jsreport.Binary.Linux.Ph2.JsReportBinary.GetBinary();
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
binary = jsreport.Binary.OSX.Ph2.JsReportBinary.GetBinary();