This file contains hidden or 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
| private static final String AMAZON_MANUFACTURED_DEVICE = "amazon"; | |
| private interface DeviceType { | |
| public static final int GOOGLE_DEVICE = 1; | |
| public static final int AMAZON_DEVICE = 2; | |
| } | |
| private int getDeviceType() { | |
| int type = 0; | |
| String manufacturer = Build.MANUFACTURER; | |
| String model = Build.MODEL; |
This file contains hidden or 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
| /// A simple websocket server Flutter app that can ping a connected client | |
| /// thanks to Simon Lightfoot @devangelslondon and Craig Labenz @craig_labenz | |
| /// #boringshow https://youtu.be/AaQzV1LTmo0?si=2xjcfH0FA5tt4nyW | |
| import 'dart:io'; | |
| import 'package:flutter/material.dart'; | |
| import 'package:shelf/shelf.dart'; | |
| import 'package:shelf/shelf_io.dart'; |
This file contains hidden or 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
| /// A simple websocket client Flutter app | |
| /// thanks to Simon Lightfoot @devangelslondon and Craig Labenz @craig_labenz | |
| /// #boringshow https://youtu.be/AaQzV1LTmo0?si=2xjcfH0FA5tt4nyW | |
| import 'package:flutter/material.dart'; | |
| import 'package:web_socket_channel/web_socket_channel.dart'; | |
| void main() { | |
| runApp(const MainApp()); | |
| } |
This file contains hidden or 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
| Created a shelf server with 'dart create -t server-shelf server1' in a mono repo using Melos. | |
| So the server is located in myrepo/apps/server1. | |
| The server runs just fine with 'dart run bin/server.dart', but when I try the Docker command | |
| from the README.md file 'docker build . -t myserver' I get a bunch of unfound file errors (ERROR OUTPUT below) | |
| I can see the files with an ls, so they are in my pub-cache | |
| > ls /Users/michaelmaitlen/.pub-cache/hosted/pub.dev/shelf-1.4.2/lib | |
| shelf.dart shelf_io.dart src | |
| I created another test server with the dart create command, by itself, not inside a mono |
This file contains hidden or 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
| Stumbled upon this, the code at the bottom compiles, but there is no output, | |
| when I was thinking it might output something like >> list 123, 456 | |
| Was looking for a shorthand to | |
| final cb = callback; | |
| if (cb != null) { | |
| cb(['123','456']); | |
| } |
This file contains hidden or 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
| // following Dart code is used to analyze an image with Moondream and Llama3.2-vision | |
| Future<String> encodeFile(String imagePath) async { | |
| File imageFile = File(imagePath); | |
| List<int> imageBytes = await imageFile.readAsBytes(); | |
| return base64Encode(imageBytes); | |
| } | |
| Future<void> analyzeWithLocalMoondream(String path) async { | |
| final base64Image = await encodeFile(path); |