yehudakremer / fluttercsharprpc Goto Github PK
View Code? Open in Web Editor NEWExecute C# code from Dart (Flutter) application
Home Page: https://pub.dev/packages/csharp_rpc
License: MIT License
Execute C# code from Dart (Flutter) application
Home Page: https://pub.dev/packages/csharp_rpc
License: MIT License
Is it possible to send message from Server without having to invoke any method from client.
I have a scenario where U.are.U 4500 Fingerprint reader Emits Callbacks for different interactions with the device.
I need to send data from C# to Flutter on each interaction.
Is is possible?
If yes? Can you please provide some example code.
please add complete c sharp example
I have used your package csharp_rpc, and it's very useful.
but i have a problem , this package connect to one class only ,
what if i need to connect to whole dot net app , so i can access any class in it
Version: 0.0.1
Whenever I attempt to run CSharpRPC on .NET Framework 4.8, the process opens for around 2 seconds or so, then will infinitely yield upon waiting for new requests to respond. Furthermore, each time you run csharpRpc = await CsharpRpc(modulePath).start();
within the Flutter app, it creates a new process under the Flutter program, of which does not close when you stop the app from running (must be closed in Task Manager).
I've tested this in Flutter Debug, although not Release. I've also only tested this within .NET Framework 4.8 / 4.7.2, though I'd be happy to test on other versions if necessary.
name: rpc_testing
description: A new Flutter project.
publish_to: 'none'
version: 1.0.0+1
environment:
sdk: '>=3.0.6 <4.0.0'
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
csharp_rpc: ^0.0.7
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0
flutter:
uses-material-design: true
using FlutterCsharpRpc;
using System.Threading.Tasks;
internal class Program
{
static async Task Main(string[] args)
{
await CsharpRpcServer.StartAsync(new Server());
}
}
using System;
public class Server
{
public void RunTest()
{
Console.Error.WriteLine($"Received new 'RunTest' request")
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net472</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FlutterCsharpRpc" Version="0.0.1" />
</ItemGroup>
</Project>
import 'package:flutter/material.dart';
import 'package:csharp_rpc/csharp_rpc.dart';
late CsharpRpc csharpRpc;
void doInjectLoop() async {
print("starting loop");
var modulePath = r"C:\Users\eric\source\repos\Project1\Project1\bin\Debug\net472\Project1.exe";
csharpRpc = await CsharpRpc(modulePath).start();
while (true) {
print(await csharpRpc.invoke(method: "RunTest"));
await Future.delayed(const Duration(seconds: 1));
}
}
void main() async {
doInjectLoop();
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headlineMedium,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
Let me know if I can provide anything else!
Is it support android and ios?
I haven't find document about how to run and publish in android and ios.
Hi YehudaKremer, i cannot find your package on pub.dev? Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.