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
I think your basic approach is flawed. You should be decoding it as a json object. | |
I've not tested this but it looks about right - chat gpt generated by asking 'change this code to decode it into a class' | |
```dart | |
void main() async { | |
try { | |
var response = await http.post( | |
Uri.parse(AppSecrecy.CharacterCreatemysql), | |
headers: {"Content-Type": "application/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
#! /usr/bin/env dcli | |
import 'dart:io'; | |
import 'package:dcli/dcli.dart'; | |
void main(List<String> arguments) { | |
final pubspec = DartProject.fromPath('.').pubSpec; | |
final isFlutter = pubspec.dependencies.containsKey('flutter'); |
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
#! /usr/bin/env dcli | |
import 'dart:io'; | |
import 'package:dcli/dcli.dart'; | |
/// Outputs a hexi-decimal representation of a file | |
/// along with an asci representation. | |
void main(List<String> args) { |
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
This script takes a tcp port no and prints out the process that has that port open. | |
I find it handy in development if I've left some server app running and its holding a port open that I'm trying to use. | |
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:tree_iterator/tree_iterator.dart'; | |
class Course { | |
var prerequisites = <Course>[]; | |
String name; | |
Course(this.name); | |
void add(Course course) => prerequisites.add(course); | |
@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
class A | |
{ | |
String? get startScriptPath => null; | |
bool addToPath(String path) { | |
if (startScriptPath != null) { | |
if (!exists(startScriptPath)) { | |
print('hi'); | |
} | |
} else { |
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
# Defines a default set of lint rules enforced for | |
# projects at Google. For details and rationale, | |
# see https://github.com/dart-lang/pedantic#enabled-lints. | |
--- | |
include: package:pedantic/analysis_options.yaml | |
# For lint rules and documentation, see http://dart-lang.github.io/linter/lints. | |
# Uncomment to specify additional rules. |
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
#! /usr/bin/env dshell | |
import 'dart:io'; | |
import 'package:dshell/dshell.dart'; | |
void main(List<String> args) { | |
var parser = ArgParser(); | |
parser.addFlag("production", abbr: 'p', defaultsTo: false); | |
var result = parser.parse(args); | |
if (result.rest.length != 2) { |
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 copyTree(String fromPath, String toPath) { | |
var list = find( | |
'*', | |
root: from, | |
recursive: true, | |
).toList(); | |
for (var file in list) { | |
var target = join(toPath, relative(file, from: fromPath)); |
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
#! /usr/bin/env dshell | |
import 'dart:convert'; | |
import 'package:dshell/dshell.dart'; | |
void main() { | |
var json = | |
'wget -qO- https://jsonplaceholder.typicode.com/todos/1'.toJson(); | |
print('Title: ${json["title"]}'); | |
} |
NewerOlder