Skip to content

Instantly share code, notes, and snippets.

@kasperpeulen
kasperpeulen / README.md
Created August 2, 2015 23:57
Finding the type of a filesystem object.

#dart:io example

Finding the type of a filesystem object.

Use the FileSystemEntity.type() method to get the type of a file system object. This method is inherited by File, Directory, and Link.

Main library: dart:io
Main element: FileSystemEntity.type
Gist: https://gist.github.com/kasperpeulen/048c53b2e7c779a2573b

@kasperpeulen
kasperpeulen / main.dart
Created August 3, 2015 23:54
Alginment is off after newline
// Copyright (c) 2014, 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.
library services.analyzer;
import 'package:analyzer/analyzer.dart';
import 'package:analyzer/src/generated/element.dart';
import 'package:analyzer/src/generated/engine.dart' hide Logger;
@kasperpeulen
kasperpeulen / main.dart
Created August 4, 2015 01:06
get dart doc information
import 'package:analyzer/analyzer.dart';
import 'package:analyzer/src/string_source.dart';
import 'package:analyzer/src/generated/element.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/sdk_io.dart';
import 'package:analyzer/src/generated/source.dart';
main() {
String doc = dartDoc("main() => print('hello world');", 10);
print(doc);
@kasperpeulen
kasperpeulen / README.md
Created August 4, 2015 02:07
Finding the type of a filesystem object

#dart:io example

Finding the type of a filesystem object

Use the FileSystemEntity.type() method to get the type of a file system object. This method is inherited by File, Directory, and Link.

Main library: dart:io
Main element: FileSystemEntity.type
Gist: https://gist.github.com/kasperpeulen/bf54439b64b66f855a46

@kasperpeulen
kasperpeulen / README.md
Last active August 29, 2015 14:26
Reading a file as a string.
@kasperpeulen
kasperpeulen / README.md
Last active August 29, 2015 14:26
Creating a file.
@kasperpeulen
kasperpeulen / README.md
Last active August 29, 2015 14:26
playground example
void main() {
Map map = {
0: "not null",
1: null
};
bool test(key) => map[key] == null;
// This will remove all key/value pairs where the value is null.
map.keys.where(test).toList().forEach(map.remove);
void main() {
Map map = {
0: "not null",
1: null
};
bool test(key) => map[key] == null;
// This will remove all key/value pairs where the value is null.
map.keys.where(test).toList().forEach(map.remove);
void main() {
Map map = {
0: "not null",
1: null
};
bool test(key) => map[key] == null;
// This will remove all key/value pairs where the value is null.
map.keys.where(test).toList().forEach(map.remove);