Flutter web state and server-side solutions with flutter - node.js

What is the current state of flutter for web in performance, specially on mobile?
And can flutter run Nodejs code?
I am fairly new to web development and was looking for a quick solution to compile my flutter apps to Web.
I am using Firebase too, so not sure if I need Nodejs right now, but its good to know if flutter supports server side programming so if I changed the backend later.
Thanks!

Related

Using flutter mobile packages in flutter web

I am using flutter web and I want to use some packages that are available for the mobile in the web version of flutter. The pubspec of flutter web look a bit different from that of flutter mobile but this is not the real problem. What I am concerned about is that is it possible to add the packages availble for mobile into that of the web. If yes, what is the proper way to do so?
This is not currently possible (as of June 2019) for any package which is dependent on the mobile OS. The reason for this is that the plugins on mobile use platform channels to communicate with platform-dependent code implementations for Android and iOS written in java/kotlin for android or objc/swift for iOS.
The only way those packages would ever work on the web is if a web-specific implementation were written for them which I assume would either use an emscripten-compiled library or more likely some sort of javascript bridge to call the relevant browser APIs.
From the flutter for web readme:
flutter_web does not have a plugin system yet. Temporarily, we provide access to dart:html, dart:js, dart:svg, dart:indexed_db and other web libraries that give you access to the vast majority of browser APIs. However, expect that these libraries will be replaced by a different plugin API.
For any plugin that is 100% dart code, you should be able to just include it in your pubspec.yaml the same way you would in flutter - under dependencies.
yes you can by take source code packages from github and take codes inside lib file inside package and put it in your project and fix errors may happen inside files by change path import to:
import 'package:flutter_web/material.dart';
and some more changes may need to do it.
it will work 100% and so easy :)

Use of npm package within Flutter

I come from an Android native background and have recently started using Flutter more frequently, but I have no ReactNative experience whatsoever.
Is it at all possible to port an existing RN (npm-package) for use with a Flutter application? My understanding is that a RN compliant package exposes a JS API. Is there any way to implement a form of JS interop to achieve this, or is it not possible, and it would be better to ask the package vendor for Android and iOS specific native library / SDK releases (which were probably used to create the npm-package initially)?
My initial outlook was that it was not possible, but then I saw this article;
https://www.thesmythgroup.com/in-development/how-to-use-npm-packages-in-native-ios-apps/
I would say it is better to use only dart packages, you don't have support for dart in npm, in some months you would have very big problems with that because of the lack of support, take that in mind...

Use MongoDB Stitch as backend for Xamarin Application

Is their any way to use mongodb stitch as backend for Xamarin Application?
Currently there are JavaScript, iOS (Swift), and Android (Java) SDKs to connect to Stitch. We've also open sourced our SDKs here, so there is the opportunity to build on what we've done as well. While there isn't a C# SDK for working with Xamarin at the moment, we have plans to investigate this later and are happy to help anyone interested in contributing.

JXcore vs Electron

question
I am wondering what the main differences are between Electron and JXcore.
background
I was thinking about how I could make a NodeJS server into an app and I came across both of these. They seem to do the same thing, except that JXcore supports mobile and Electron doesn't.
side question
If Electron doesn't support mobile then how was the slack mobile app created?
Thanks in advance!
From the JXCore site(http://jxcore.com/tech/):
JXcore is a fork on the open source Node.js project
It uses LLVM to compile javascript as opposed to V8 which NodeJS does.
In terms of what are the main differences- Electron is a framework for building native, cross platform desktop applications, where it appears JXCore is a javascript engine forked from NodeJS.
Electron is built with NodeJS, and Chromium. So to make it fair, the comparison would be better stated "How does Electron work with NodeJS vs JXcore". Since I don't have any experience with JXCore, I can't answer that question. I would venture to say the only way to know that is to fork electron and replace Node with JXCore.
Based on your background, I would assume you are thinking about making one application that works cross platform across mobile and desktop environments. To that, I would say it is possible, but you are going to have 2 different projects. There are things in Electron that you wouldn't want included in your mobile app, since they are working with completely different operating systems. You are right that electron does not support mobile (it wasn't built for that).
As far as your side question goes, there are any number of technologies that slack could have used to create their mobile app. They could have used Java , Swift, Objective-C, .NET, Ruby, or Javascript.
There are cross platform tools such as RubyMotion, NativeScript, React Native, and Xamarin that could also be used to create native mobile apps, that all compile down into the native language the mobile OS understands.
A final approach could be the use of tools such as Cordova/Phonegap which create mobile apps via a "web view". Essentially, this is like creating an app that launches a web browser to interact with your phone.
If you are looking for an example on how to build once and use everywhere, I would look at the github repo found here https://github.com/NathanWalker/angular-seed-advanced. This shows a common codebase that can be used in Electron, Web, and Mobile.

how to combine these angularjs, visual studio & nodejs

I am coming from MVC background and has recently started development using angularjs.
I am using Visual Studio for the WebApi development and using MVC from angularjs.
The basic template for hosting webapi i had picked from: here
But now i dont have any way for minification & bundling, which would in production drastically hamper the app load time. Is there any way to use minification & bundling with angularjs & webapi without using MVC.
While looking for solution i came across "Node.Js Tools for Visual Studio" which seems to came to my rescue. Now i am having separate projects for webapi and angularjs. i am using node.js for build & testing purposes. npm for installing packages in angular project & nuget for installing any dependencies for webapi project. Now, I can do all the development in visual studio.
But I am still not sure about few things:
how do i make connect between webapi & angularjs. i need to host both in different ports and do the CORS from angularjs.
if i make a change in webapi, will i have to host it again and then test it... is there no easy way out?
Btw, combining visual studio with node.js - is that a bad idea? should i keep the mvc with webapi and angularjs in same visual studio project and using mvc bundling-minification... so i am not worried about hosting & deployment.
Note: I am using NHibernate and have to connect with Oracle. is there any other option that i can try apart from webapi which can make the things easier.
Sorry for my lack of knowledge on how the things on overall level works.. how do these threads combine, and thanks for helping me out. I have done enough googling but was not able to find out a solution. if somebody can point me to some articles it would be great.
AngularJs is built perfectly for communicating with RESTful web apis. Look at the $http and $resource providers. If you are communicating cross domain, you will have to set up CORS in your web api application.
If your project is set up that your angular app is also served by your web api server, you can debug local, make and deploy changes together, etc.
Node.js is a great solution for non-mvc bundling, linting and minification, but nuget does the same thing as npm, and in most cases, it's more suitable for the visual studio experience.
If you're using node.js, you can pretty much wrap anything you like to communicate with oracle.

Resources